Commit 589464ce authored by Constantin Rack's avatar Constantin Rack

Problem: comments still refer to deprecated `zmq_term`.

Solution: replace with `zmq_ctx_term`

Also fix whitespace (tabs instead of spaces)
parent 10d9ef8a
...@@ -135,19 +135,19 @@ zmq::ctx_t::~ctx_t () ...@@ -135,19 +135,19 @@ zmq::ctx_t::~ctx_t ()
int zmq::ctx_t::terminate () int zmq::ctx_t::terminate ()
{ {
slot_sync.lock(); slot_sync.lock();
bool saveTerminating = terminating; bool saveTerminating = terminating;
terminating = false; terminating = false;
// Connect up any pending inproc connections, otherwise we will hang // Connect up any pending inproc connections, otherwise we will hang
pending_connections_t copy = pending_connections; pending_connections_t copy = pending_connections;
for (pending_connections_t::iterator p = copy.begin (); p != copy.end (); ++p) { for (pending_connections_t::iterator p = copy.begin (); p != copy.end (); ++p) {
zmq::socket_base_t *s = create_socket (ZMQ_PAIR); zmq::socket_base_t *s = create_socket (ZMQ_PAIR);
s->bind (p->first.c_str ()); s->bind (p->first.c_str ());
s->close (); s->close ();
} }
terminating = saveTerminating; terminating = saveTerminating;
if (!starting) { if (!starting) {
......
...@@ -75,7 +75,7 @@ namespace zmq ...@@ -75,7 +75,7 @@ namespace zmq
// Returns false if object is not a context. // Returns false if object is not a context.
bool check_tag (); bool check_tag ();
// This function is called when user invokes zmq_term. If there are // This function is called when user invokes zmq_ctx_term. If there are
// no more sockets open it'll cause all the infrastructure to be shut // no more sockets open it'll cause all the infrastructure to be shut
// down. If there are open sockets still, the deallocation happens // down. If there are open sockets still, the deallocation happens
// after the last one is closed. // after the last one is closed.
...@@ -146,8 +146,8 @@ namespace zmq ...@@ -146,8 +146,8 @@ namespace zmq
uint32_t tag; uint32_t tag;
// Sockets belonging to this context. We need the list so that // Sockets belonging to this context. We need the list so that
// we can notify the sockets when zmq_term() is called. The sockets // we can notify the sockets when zmq_ctx_term() is called.
// will return ETERM then. // The sockets will return ETERM then.
typedef array_t <socket_base_t> sockets_t; typedef array_t <socket_base_t> sockets_t;
sockets_t sockets; sockets_t sockets;
...@@ -159,7 +159,7 @@ namespace zmq ...@@ -159,7 +159,7 @@ namespace zmq
// yet. Launching of I/O threads is delayed. // yet. Launching of I/O threads is delayed.
bool starting; bool starting;
// If true, zmq_term was already called. // If true, zmq_ctx_term was already called.
bool terminating; bool terminating;
// Synchronisation of accesses to global slot-related data: // Synchronisation of accesses to global slot-related data:
...@@ -179,7 +179,7 @@ namespace zmq ...@@ -179,7 +179,7 @@ namespace zmq
uint32_t slot_count; uint32_t slot_count;
i_mailbox **slots; i_mailbox **slots;
// Mailbox for zmq_term thread. // Mailbox for zmq_ctx_term thread.
mailbox_t term_mailbox; mailbox_t term_mailbox;
// List of inproc endpoints within this context. // List of inproc endpoints within this context.
......
...@@ -223,8 +223,8 @@ zmq::i_mailbox *zmq::socket_base_t::get_mailbox () ...@@ -223,8 +223,8 @@ zmq::i_mailbox *zmq::socket_base_t::get_mailbox ()
void zmq::socket_base_t::stop () void zmq::socket_base_t::stop ()
{ {
// Called by ctx when it is terminated (zmq_term). // Called by ctx when it is terminated (zmq_ctx_term).
// 'stop' command is sent from the threads that called zmq_term to // 'stop' command is sent from the threads that called zmq_ctx_term to
// the thread owning the socket. This way, blocking call in the // the thread owning the socket. This way, blocking call in the
// owner thread can be interrupted. // owner thread can be interrupted.
send_stop (); send_stop ();
...@@ -1376,7 +1376,7 @@ int zmq::socket_base_t::process_commands (int timeout_, bool throttle_) ...@@ -1376,7 +1376,7 @@ int zmq::socket_base_t::process_commands (int timeout_, bool throttle_)
void zmq::socket_base_t::process_stop () void zmq::socket_base_t::process_stop ()
{ {
// Here, someone have called zmq_term while the socket was still alive. // Here, someone have called zmq_ctx_term while the socket was still alive.
// We'll remember the fact so that any blocking call is interrupted and any // We'll remember the fact so that any blocking call is interrupted and any
// further attempt to use the socket will return ETERM. The user is still // further attempt to use the socket will return ETERM. The user is still
// responsible for calling zmq_close on the socket though! // responsible for calling zmq_close on the socket though!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment