From ce0972dca3982538fd123b61fbae3928fad6d1e7 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Wed, 1 Sep 2010 07:57:38 +0200 Subject: context creates an inproc endpoint ('inproc://log') to distribute 0MQ's log messages --- src/ctx.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/ctx.hpp') diff --git a/src/ctx.hpp b/src/ctx.hpp index a31e1d8..5f6cc83 100644 --- a/src/ctx.hpp +++ b/src/ctx.hpp @@ -24,6 +24,8 @@ #include #include +#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&); }; -- cgit v1.2.3