context creates an inproc endpoint ('inproc://log') to distribute 0MQ's log messages

This commit is contained in:
Martin Sustrik
2010-09-01 07:57:38 +02:00
parent db73c76314
commit ce0972dca3
4 changed files with 43 additions and 2 deletions

View File

@@ -24,6 +24,8 @@
#include <vector>
#include <string>
#include "../include/zmq.h"
#include "signaler.hpp"
#include "semaphore.hpp"
#include "ypipe.hpp"
@@ -74,6 +76,9 @@ namespace zmq
void unregister_endpoints (class socket_base_t *socket_);
class socket_base_t *find_endpoint (const char *addr_);
// Logging.
void log (zmq_msg_t *msg_);
private:
~ctx_t ();
@@ -125,6 +130,11 @@ namespace zmq
// Synchronisation of access to the list of inproc endpoints.
mutex_t endpoints_sync;
// PUB socket for logging. The socket is shared among all the threads,
// thus it is synchronised by a mutex.
class socket_base_t *log_socket;
mutex_t log_sync;
ctx_t (const ctx_t&);
void operator = (const ctx_t&);
};