diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2012-02-16 10:01:26 +0900 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2012-02-16 10:01:26 +0900 |
commit | 4c9cc8a724dfee204fb7a42632c1cc802e6aa83f (patch) | |
tree | ff0f70f73dcd8385232350aca9c478c49312b265 | |
parent | b8ba042912233045b6ca74f732bcc7265dfeb5b0 (diff) |
Old logging infrastructure removed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r-- | src/ctx.cpp | 38 | ||||
-rw-r--r-- | src/ctx.hpp | 8 | ||||
-rw-r--r-- | src/monitor.cpp | 4 | ||||
-rw-r--r-- | src/monitor.hpp | 2 | ||||
-rw-r--r-- | src/object.cpp | 8 | ||||
-rw-r--r-- | src/object.hpp | 3 |
6 files changed, 8 insertions, 55 deletions
diff --git a/src/ctx.cpp b/src/ctx.cpp index 3ef2d4a..437feed 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -42,11 +42,9 @@ zmq::ctx_t::ctx_t (uint32_t io_threads_) : tag (0xbadcafe0), terminating (false) { - int rc; - // Initialise the array of mailboxes. Additional three slots are for - // internal log socket and the zmq_term thread the reaper thread. - slot_count = max_sockets + io_threads_ + 3; + // zmq_term thread and reaper thread. + slot_count = max_sockets + io_threads_ + 2; slots = (mailbox_t**) malloc (sizeof (mailbox_t*) * slot_count); alloc_assert (slots); @@ -75,12 +73,6 @@ zmq::ctx_t::ctx_t (uint32_t io_threads_) : slots [i] = NULL; } - // Create the logging infrastructure. - log_socket = create_socket (ZMQ_PUB); - zmq_assert (log_socket); - rc = log_socket->bind ("sys://log"); - zmq_assert (rc == 0); - // Create the monitor object. io_thread_t *io_thread = choose_io_thread (0); zmq_assert (io_thread); @@ -138,13 +130,6 @@ int zmq::ctx_t::terminate () zmq_assert (rc == 0); zmq_assert (cmd.type == command_t::done); - // Close the logging infrastructure. - log_sync.lock (); - rc = log_socket->close (); - zmq_assert (rc == 0); - log_socket = NULL; - log_sync.unlock (); - // First send stop command to sockets so that any blocking calls // can be interrupted. If there are no sockets we can ask reaper // thread to stop. @@ -322,25 +307,6 @@ zmq::endpoint_t zmq::ctx_t::find_endpoint (const char *addr_) return *endpoint; } -void zmq::ctx_t::log (const char *format_, va_list args_) -{ - // Create the log message. - msg_t msg; - int rc = msg.init_size (strlen (format_) + 1); - errno_assert (rc == 0); - memcpy (msg.data (), format_, msg.size ()); - - // At this point we migrate the log socket to the current thread. - // We rely on mutex for executing the memory barrier. - log_sync.lock (); - if (log_socket) - log_socket->send (&msg, 0); - log_sync.unlock (); - - rc = msg.close (); - errno_assert (rc == 0); -} - // The last used socket ID, or 0 if no socket was used so far. zmq::atomic_counter_t zmq::ctx_t::max_socket_id; diff --git a/src/ctx.hpp b/src/ctx.hpp index 6a337d5..59d753e 100644 --- a/src/ctx.hpp +++ b/src/ctx.hpp @@ -93,9 +93,6 @@ namespace zmq void unregister_endpoints (zmq::socket_base_t *socket_); endpoint_t find_endpoint (const char *addr_); - // Logging. - void log (const char *format_, va_list args_); - enum { term_tid = 0, reaper_tid = 1 @@ -148,11 +145,6 @@ 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. - zmq::socket_base_t *log_socket; - mutex_t log_sync; - // Monitor object attached to the context. zmq::monitor_t *monitor; diff --git a/src/monitor.cpp b/src/monitor.cpp index 77bb8f1..95212fd 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -44,6 +44,10 @@ void zmq::monitor_t::stop () send_stop (); } +void zmq::monitor_t::log (int sid_, const char *text_) +{ +} + void zmq::monitor_t::process_plug () { // Schedule sending of the first snapshot. diff --git a/src/monitor.hpp b/src/monitor.hpp index 439939f..83ffb26 100644 --- a/src/monitor.hpp +++ b/src/monitor.hpp @@ -40,6 +40,8 @@ namespace zmq void start (); void stop (); + void log (int sid_, const char *text_); + private: enum {timer_id = 0x44}; diff --git a/src/object.cpp b/src/object.cpp index 622754c..04044d3 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -149,14 +149,6 @@ void zmq::object_t::destroy_socket (socket_base_t *socket_) ctx->destroy_socket (socket_); } -void zmq::object_t::log (const char *format_, ...) -{ - va_list args; - va_start (args, format_); - ctx->log (format_, args); - va_end (args); -} - zmq::io_thread_t *zmq::object_t::choose_io_thread (uint64_t affinity_) { return ctx->choose_io_thread (affinity_); diff --git a/src/object.hpp b/src/object.hpp index 932cea7..791a7e3 100644 --- a/src/object.hpp +++ b/src/object.hpp @@ -61,9 +61,6 @@ namespace zmq zmq::endpoint_t find_endpoint (const char *addr_); void destroy_socket (zmq::socket_base_t *socket_); - // Logs an message. - void log (const char *format_, ...); - // Chooses least loaded I/O thread. zmq::io_thread_t *choose_io_thread (uint64_t affinity_); |