summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-04-29 18:03:54 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-04-29 18:03:54 +0200
commit1ffc6dd41f2e2ce45c67f3fe08780c5a09cf667d (patch)
treea590cfc5ceb6f531dd1c6e49ddbb9b4a6a0a4716 /src
parent37128b7b1aeed9ad2bf6816560b85b5f94dd5bec (diff)
eventfd-style signaling removed
Diffstat (limited to 'src')
-rw-r--r--src/signaler.cpp78
-rw-r--r--src/signaler.hpp6
2 files changed, 1 insertions, 83 deletions
diff --git a/src/signaler.cpp b/src/signaler.cpp
index a98f1fe..1d3b32f 100644
--- a/src/signaler.cpp
+++ b/src/signaler.cpp
@@ -32,83 +32,7 @@
#include <fcntl.h>
#endif
-#if defined ZMQ_HAVE_EVENTFD
-
-#include <sys/eventfd.h>
-
-zmq::signaler_t::signaler_t ()
-{
- // Create eventfd object.
- fd = eventfd (0, 0);
- errno_assert (fd != -1);
-
- // Set to non-blocking mode.
- int flags = fcntl (fd, F_GETFL, 0);
- if (flags == -1)
- flags = 0;
- int rc = fcntl (fd, F_SETFL, flags | O_NONBLOCK);
- errno_assert (rc != -1);
-}
-
-zmq::signaler_t::~signaler_t ()
-{
- int rc = close (fd);
- errno_assert (rc != -1);
-}
-
-void zmq::signaler_t::signal (int signal_)
-{
- zmq_assert (signal_ >= 0 && signal_ < 64);
- uint64_t inc = 1;
- inc <<= signal_;
- ssize_t sz = write (fd, &inc, sizeof (uint64_t));
- errno_assert (sz == sizeof (uint64_t));
-}
-
-uint64_t zmq::signaler_t::poll ()
-{
- // Set to blocking mode.
- int flags = fcntl (fd, F_GETFL, 0);
- if (flags == -1)
- flags = 0;
- int rc = fcntl (fd, F_SETFL, flags & ~O_NONBLOCK);
- errno_assert (rc != -1);
-
- uint64_t signals;
- ssize_t sz;
- while (true) {
- sz = read (fd, &signals, sizeof (uint64_t));
- if (sz == -1) {
- if (errno == EAGAIN || errno == EINTR)
- continue;
- errno_assert (false);
- }
- break;
- }
-
- // Set to non-blocking mode.
- rc = fcntl (fd, F_SETFL, flags | O_NONBLOCK);
- errno_assert (rc != -1);
-
- return signals;
-}
-
-uint64_t zmq::signaler_t::check ()
-{
- uint64_t signals;
- ssize_t sz = read (fd, &signals, sizeof (uint64_t));
- if (sz == -1 && (errno == EAGAIN || errno == EINTR))
- return 0;
- errno_assert (sz != -1);
- return signals;
-}
-
-zmq::fd_t zmq::signaler_t::get_fd ()
-{
- return fd;
-}
-
-#elif defined ZMQ_HAVE_WINDOWS
+#if defined ZMQ_HAVE_WINDOWS
zmq::signaler_t::signaler_t ()
{
diff --git a/src/signaler.hpp b/src/signaler.hpp
index 29f2ff6..f239771 100644
--- a/src/signaler.hpp
+++ b/src/signaler.hpp
@@ -58,17 +58,11 @@ namespace zmq
// meantime, we'll create the socket pair manually.
static int socketpair (int domain_, int type_, int protocol_,
int sv_ [2]);
-
#endif
-#if defined ZMQ_HAVE_EVENTFD
- // Eventfd descriptor.
- fd_t fd;
-#else
// Write & read end of the socketpair.
fd_t w;
fd_t r;
-#endif
// Disable copying of fd_signeler object.
signaler_t (const signaler_t&);