Commit 08201bc1 authored by Simon Giesecke's avatar Simon Giesecke

Problem: select blocks forever under Unix

Solution: fixed call of select, and initialization of poll_t members
parent a30133d8
...@@ -189,9 +189,9 @@ int zmq::select_t::try_retire_fd_entry ( ...@@ -189,9 +189,9 @@ int zmq::select_t::try_retire_fd_entry (
void zmq::select_t::rm_fd (handle_t handle_) void zmq::select_t::rm_fd (handle_t handle_)
{ {
int retired = 0;
#if defined ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS
u_short family = get_fd_family (handle_); u_short family = get_fd_family (handle_);
int retired = 0;
if (family != AF_UNSPEC) { if (family != AF_UNSPEC) {
family_entries_t::iterator family_entry_it = family_entries_t::iterator family_entry_it =
family_entries.find (family); family_entries.find (family);
...@@ -411,7 +411,7 @@ void zmq::select_t::loop () ...@@ -411,7 +411,7 @@ void zmq::select_t::loop ()
} }
} }
#else #else
select_family_entry (family_entry, maxfd, timeout > 0, tv); select_family_entry (family_entry, maxfd + 1, timeout > 0, tv);
#endif #endif
} }
zmq_stopwatch_stop (stopwatch); zmq_stopwatch_stop (stopwatch);
...@@ -523,6 +523,11 @@ bool zmq::select_t::is_retired_fd (const fd_entry_t &entry) ...@@ -523,6 +523,11 @@ bool zmq::select_t::is_retired_fd (const fd_entry_t &entry)
return (entry.fd == retired_fd); return (entry.fd == retired_fd);
} }
zmq::select_t::family_entry_t::family_entry_t () : has_retired (false)
{
}
#if defined ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS
u_short zmq::select_t::get_fd_family (fd_t fd_) u_short zmq::select_t::get_fd_family (fd_t fd_)
{ {
...@@ -579,11 +584,6 @@ u_short zmq::select_t::determine_fd_family (fd_t fd_) ...@@ -579,11 +584,6 @@ u_short zmq::select_t::determine_fd_family (fd_t fd_)
return AF_UNSPEC; return AF_UNSPEC;
} }
zmq::select_t::family_entry_t::family_entry_t () : has_retired (false)
{
}
zmq::select_t::wsa_events_t::wsa_events_t () zmq::select_t::wsa_events_t::wsa_events_t ()
{ {
events[0] = WSACreateEvent (); events[0] = WSACreateEvent ();
......
...@@ -115,11 +115,7 @@ class select_t : public poller_base_t ...@@ -115,11 +115,7 @@ class select_t : public poller_base_t
struct family_entry_t struct family_entry_t
{ {
#ifndef ZMQ_HAVE_WINDOWS
family_entry_t () {};
#else
family_entry_t (); family_entry_t ();
#endif
fd_entries_t fd_entries; fd_entries_t fd_entries;
fds_set_t fds_set; fds_set_t fds_set;
...@@ -161,7 +157,6 @@ class select_t : public poller_base_t ...@@ -161,7 +157,6 @@ class select_t : public poller_base_t
// on non-Windows, we can treat all fds as one family // on non-Windows, we can treat all fds as one family
family_entry_t family_entry; family_entry_t family_entry;
fd_t maxfd; fd_t maxfd;
bool retired;
#endif #endif
// Checks if an fd_entry_t is retired. // Checks if an fd_entry_t is retired.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment