Reaper thread waits for commands rather them retrieving them periodically

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
Martin Sustrik
2011-02-09 22:23:21 +01:00
parent 80ac398bba
commit 5b82b1ba30
7 changed files with 106 additions and 72 deletions

View File

@@ -47,15 +47,10 @@ namespace zmq
private:
void reap ();
// Command handlers.
void process_stop ();
void process_reap (class socket_base_t *socket_);
// List of all sockets being terminated.
typedef std::vector <class socket_base_t*> sockets_t;
sockets_t sockets;
void process_reaped ();
// Reaper thread accesses incoming commands via this mailbox.
mailbox_t mailbox;
@@ -66,12 +61,12 @@ namespace zmq
// I/O multiplexing is performed using a poller object.
poller_t *poller;
// Number of sockets being reaped at the moment.
int sockets;
// If true, we were already asked to terminate.
bool terminating;
// If true, timer till next reaping is running.
bool has_timer;
reaper_t (const reaper_t&);
const reaper_t &operator = (const reaper_t&);
};