mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-31 22:45:38 +01:00
Problem: wsa_events are initialized/destroyed within every loop
iteration even if not used Solution: Move wsa_events closer to usage
This commit is contained in:
parent
dec3af4d69
commit
cd32603c0e
@ -258,10 +258,11 @@ void zmq::select_t::loop ()
|
|||||||
family because Windows seems to handle them properly.
|
family because Windows seems to handle them properly.
|
||||||
See get_fd_family for details.
|
See get_fd_family for details.
|
||||||
*/
|
*/
|
||||||
wsa_events_t wsa_events;
|
|
||||||
|
|
||||||
// If there is just one family, there is no reason to use WSA events.
|
// If there is just one family, there is no reason to use WSA events.
|
||||||
if (family_entries.size () > 1) {
|
if (family_entries.size () > 1) {
|
||||||
|
wsa_events_t wsa_events;
|
||||||
|
|
||||||
for (family_entries_t::iterator family_entry_it = family_entries.begin ();
|
for (family_entries_t::iterator family_entry_it = family_entries.begin ();
|
||||||
family_entry_it != family_entries.end (); ++family_entry_it) {
|
family_entry_it != family_entries.end (); ++family_entry_it) {
|
||||||
family_entry_t& family_entry = family_entry_it->second;
|
family_entry_t& family_entry = family_entry_it->second;
|
||||||
@ -290,11 +291,7 @@ void zmq::select_t::loop ()
|
|||||||
wsa_assert (rc != SOCKET_ERROR);
|
wsa_assert (rc != SOCKET_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined ZMQ_HAVE_WINDOWS
|
|
||||||
if (family_entries.size () > 1) {
|
|
||||||
rc = WSAWaitForMultipleEvents (4, wsa_events.events, FALSE,
|
rc = WSAWaitForMultipleEvents (4, wsa_events.events, FALSE,
|
||||||
timeout ? timeout : INFINITE, FALSE);
|
timeout ? timeout : INFINITE, FALSE);
|
||||||
wsa_assert (rc != (int)WSA_WAIT_FAILED);
|
wsa_assert (rc != (int)WSA_WAIT_FAILED);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user