summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorunknown <bundra@.(none)>2010-02-24 15:33:03 +0100
committerunknown <bundra@.(none)>2010-02-24 15:33:03 +0100
commitb7f01f9071c26292c30517bac18dae92efaf3ffb (patch)
tree438b77e82e7b79bc7f5905978527d856b9c75402 /src
parent476ebde6280a428e2dd8fee7c70670aa449831c9 (diff)
chat example removed from win build; missing fd_signaler_t::poll on win added
Diffstat (limited to 'src')
-rw-r--r--src/fd_signaler.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/fd_signaler.cpp b/src/fd_signaler.cpp
index f1ec6af..653f36d 100644
--- a/src/fd_signaler.cpp
+++ b/src/fd_signaler.cpp
@@ -153,9 +153,9 @@ zmq::fd_signaler_t::fd_signaler_t ()
wsa_assert (r != INVALID_SOCKET);
// Set the read site of the pair to non-blocking mode.
- //unsigned long argp = 1;
- //rc = ioctlsocket (r, FIONBIO, &argp);
- //wsa_assert (rc != SOCKET_ERROR);
+ unsigned long argp = 1;
+ rc = ioctlsocket (r, FIONBIO, &argp);
+ wsa_assert (rc != SOCKET_ERROR);
// We don't need the listening socket anymore. Close it.
rc = closesocket (listener);
@@ -184,10 +184,22 @@ void zmq::fd_signaler_t::signal (int signal_)
uint64_t zmq::fd_signaler_t::poll ()
{
- // TODO: Can we do a blocking read on non-blocking socket?
- // It's not needed as for now, so let it stay unimplemented.
- zmq_assert (false);
- return 0;
+ // Switch to blocking mode.
+ unsigned long argp = 0;
+ int rc = ioctlsocket (r, FIONBIO, &argp);
+ wsa_assert (rc != SOCKET_ERROR);
+
+ // Get the signals. Given that we are in the blocking mode now,
+ // there should be at least a single signal returned.
+ uint64_t signals = check ();
+ zmq_assert (signals);
+
+ // Switch back to non-blocking mode.
+ argp = 1;
+ rc = ioctlsocket (r, FIONBIO, &argp);
+ wsa_assert (rc != SOCKET_ERROR);
+
+ return signals;
}
uint64_t zmq::fd_signaler_t::check ()