summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/asio/detail/impl/pipe_select_interrupter.ipp')
-rw-r--r--3rdParty/Boost/src/boost/asio/detail/impl/pipe_select_interrupter.ipp27
1 files changed, 26 insertions, 1 deletions
diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/pipe_select_interrupter.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/pipe_select_interrupter.ipp
index 9a0a872..75a8d16 100644
--- a/3rdParty/Boost/src/boost/asio/detail/impl/pipe_select_interrupter.ipp
+++ b/3rdParty/Boost/src/boost/asio/detail/impl/pipe_select_interrupter.ipp
@@ -2,7 +2,7 @@
// detail/impl/pipe_select_interrupter.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -38,6 +38,11 @@ namespace detail {
pipe_select_interrupter::pipe_select_interrupter()
{
+ open_descriptors();
+}
+
+void pipe_select_interrupter::open_descriptors()
+{
int pipe_fds[2];
if (pipe(pipe_fds) == 0)
{
@@ -45,6 +50,11 @@ pipe_select_interrupter::pipe_select_interrupter()
::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK);
write_descriptor_ = pipe_fds[1];
::fcntl(write_descriptor_, F_SETFL, O_NONBLOCK);
+
+#if defined(FD_CLOEXEC)
+ ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC);
+ ::fcntl(write_descriptor_, F_SETFD, FD_CLOEXEC);
+#endif // defined(FD_CLOEXEC)
}
else
{
@@ -56,12 +66,27 @@ pipe_select_interrupter::pipe_select_interrupter()
pipe_select_interrupter::~pipe_select_interrupter()
{
+ close_descriptors();
+}
+
+void pipe_select_interrupter::close_descriptors()
+{
if (read_descriptor_ != -1)
::close(read_descriptor_);
if (write_descriptor_ != -1)
::close(write_descriptor_);
}
+void pipe_select_interrupter::recreate()
+{
+ close_descriptors();
+
+ write_descriptor_ = -1;
+ read_descriptor_ = -1;
+
+ open_descriptors();
+}
+
void pipe_select_interrupter::interrupt()
{
char byte = 0;