diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2010-11-05 16:38:52 +0100 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2010-11-05 16:38:52 +0100 |
commit | 9cfdb441f45057c7106a101835d65164fce9470a (patch) | |
tree | 20b7db26b4f27b726d15ec80aa24333f1c02d729 /src | |
parent | 623a9c9f1b53bdda9ad61f58cdc7a286e3e474cd (diff) |
slots renamed to tids
Threads were so far identified by integers called 'slots'.
This patch renames them to more comprehensible 'tid's (thread IDs).
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/ctx.cpp | 12 | ||||
-rw-r--r-- | src/ctx.hpp | 6 | ||||
-rw-r--r-- | src/io_thread.cpp | 4 | ||||
-rw-r--r-- | src/io_thread.hpp | 2 | ||||
-rw-r--r-- | src/object.cpp | 14 | ||||
-rw-r--r-- | src/object.hpp | 8 | ||||
-rw-r--r-- | src/own.cpp | 4 | ||||
-rw-r--r-- | src/own.hpp | 2 | ||||
-rw-r--r-- | src/pair.cpp | 4 | ||||
-rw-r--r-- | src/pair.hpp | 2 | ||||
-rw-r--r-- | src/pub.cpp | 4 | ||||
-rw-r--r-- | src/pub.hpp | 2 | ||||
-rw-r--r-- | src/pull.cpp | 4 | ||||
-rw-r--r-- | src/pull.hpp | 2 | ||||
-rw-r--r-- | src/push.cpp | 4 | ||||
-rw-r--r-- | src/push.hpp | 2 | ||||
-rw-r--r-- | src/rep.cpp | 4 | ||||
-rw-r--r-- | src/rep.hpp | 2 | ||||
-rw-r--r-- | src/req.cpp | 4 | ||||
-rw-r--r-- | src/req.hpp | 2 | ||||
-rw-r--r-- | src/socket_base.cpp | 24 | ||||
-rw-r--r-- | src/socket_base.hpp | 4 | ||||
-rw-r--r-- | src/sub.cpp | 4 | ||||
-rw-r--r-- | src/sub.hpp | 2 | ||||
-rw-r--r-- | src/xrep.cpp | 4 | ||||
-rw-r--r-- | src/xrep.hpp | 2 | ||||
-rw-r--r-- | src/xreq.cpp | 4 | ||||
-rw-r--r-- | src/xreq.hpp | 2 |
28 files changed, 67 insertions, 67 deletions
diff --git a/src/ctx.cpp b/src/ctx.cpp index ff7c68c..b4c27fd 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -92,7 +92,7 @@ zmq::ctx_t::~ctx_t () for (io_threads_t::size_type i = 0; i != io_threads.size (); i++) delete io_threads [i]; - // Deallocate the array of slot. No special work is + // Deallocate the array of slots. No special work is // needed as signalers themselves were deallocated with their // corresponding io_thread/socket objects. free (slots); @@ -216,9 +216,9 @@ void zmq::ctx_t::zombify_socket (socket_base_t *socket_) slot_sync.unlock (); } -void zmq::ctx_t::send_command (uint32_t slot_, const command_t &command_) +void zmq::ctx_t::send_command (uint32_t tid_, const command_t &command_) { - slots [slot_]->send (command_); + slots [tid_]->send (command_); } zmq::io_thread_t *zmq::ctx_t::choose_io_thread (uint64_t affinity_) @@ -314,7 +314,7 @@ void zmq::ctx_t::dezombify () // Try to dezombify each zombie in the list. Note that caller is // responsible for calling this method in the slot_sync critical section. for (zombies_t::iterator it = zombies.begin (); it != zombies.end ();) { - uint32_t slot = (*it)->get_slot (); + uint32_t tid = (*it)->get_tid (); if ((*it)->dezombify ()) { #if defined _MSC_VER @@ -323,8 +323,8 @@ void zmq::ctx_t::dezombify () #else zombies.erase (it); #endif - empty_slots.push_back (slot); - slots [slot] = NULL; + empty_slots.push_back (tid); + slots [tid] = NULL; } else it++; diff --git a/src/ctx.hpp b/src/ctx.hpp index a86482c..5a3a6aa 100644 --- a/src/ctx.hpp +++ b/src/ctx.hpp @@ -61,8 +61,8 @@ namespace zmq // Make socket a zombie. void zombify_socket (socket_base_t *socket_); - // Send command to the destination slot. - void send_command (uint32_t slot_, const command_t &command_); + // Send command to the destination thread. + void send_command (uint32_t tid_, const command_t &command_); // Returns the I/O thread that is the least busy at the moment. // Affinity specifies which I/O threads are eligible (0 = all). @@ -90,7 +90,7 @@ namespace zmq typedef std::vector <socket_base_t*> zombies_t; zombies_t zombies; - // List of unused slots. + // List of unused thread slots. typedef std::vector <uint32_t> emtpy_slots_t; emtpy_slots_t empty_slots; diff --git a/src/io_thread.cpp b/src/io_thread.cpp index ef8211e..aacf843 100644 --- a/src/io_thread.cpp +++ b/src/io_thread.cpp @@ -26,8 +26,8 @@ #include "err.hpp" #include "ctx.hpp" -zmq::io_thread_t::io_thread_t (ctx_t *ctx_, uint32_t slot_) : - object_t (ctx_, slot_) +zmq::io_thread_t::io_thread_t (ctx_t *ctx_, uint32_t tid_) : + object_t (ctx_, tid_) { poller = new (std::nothrow) poller_t; zmq_assert (poller); diff --git a/src/io_thread.hpp b/src/io_thread.hpp index b84f8ec..a0704fc 100644 --- a/src/io_thread.hpp +++ b/src/io_thread.hpp @@ -38,7 +38,7 @@ namespace zmq { public: - io_thread_t (class ctx_t *ctx_, uint32_t slot_); + io_thread_t (class ctx_t *ctx_, uint32_t tid_); // Clean-up. If the thread was started, it's neccessary to call 'stop' // before invoking destructor. Otherwise the destructor would hang up. diff --git a/src/object.cpp b/src/object.cpp index 447773f..3e3ddec 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -27,15 +27,15 @@ #include "session.hpp" #include "socket_base.hpp" -zmq::object_t::object_t (ctx_t *ctx_, uint32_t slot_) : +zmq::object_t::object_t (ctx_t *ctx_, uint32_t tid_) : ctx (ctx_), - slot (slot_) + tid (tid_) { } zmq::object_t::object_t (object_t *parent_) : ctx (parent_->ctx), - slot (parent_->slot) + tid (parent_->tid) { } @@ -43,9 +43,9 @@ zmq::object_t::~object_t () { } -uint32_t zmq::object_t::get_slot () +uint32_t zmq::object_t::get_tid () { - return slot; + return tid; } zmq::ctx_t *zmq::object_t::get_ctx () @@ -162,7 +162,7 @@ void zmq::object_t::send_stop () #endif cmd.destination = this; cmd.type = command_t::stop; - ctx->send_command (slot, cmd); + ctx->send_command (tid, cmd); } void zmq::object_t::send_plug (own_t *destination_, bool inc_seqnum_) @@ -404,6 +404,6 @@ void zmq::object_t::process_seqnum () void zmq::object_t::send_command (command_t &cmd_) { - ctx->send_command (cmd_.destination->get_slot (), cmd_); + ctx->send_command (cmd_.destination->get_tid (), cmd_); } diff --git a/src/object.hpp b/src/object.hpp index 390cae1..f8cfdda 100644 --- a/src/object.hpp +++ b/src/object.hpp @@ -34,11 +34,11 @@ namespace zmq { public: - object_t (class ctx_t *ctx_, uint32_t slot_); + object_t (class ctx_t *ctx_, uint32_t tid_); object_t (object_t *parent_); virtual ~object_t (); - uint32_t get_slot (); + uint32_t get_tid (); ctx_t *get_ctx (); void process_command (struct command_t &cmd_); @@ -110,8 +110,8 @@ namespace zmq // Context provides access to the global state. class ctx_t *ctx; - // Slot ID of the thread the object belongs to. - uint32_t slot; + // Thread ID of the thread the object belongs to. + uint32_t tid; void send_command (command_t &cmd_); diff --git a/src/own.cpp b/src/own.cpp index b74bb1a..955113a 100644 --- a/src/own.cpp +++ b/src/own.cpp @@ -21,8 +21,8 @@ #include "err.hpp" #include "io_thread.hpp" -zmq::own_t::own_t (class ctx_t *parent_, uint32_t slot_) : - object_t (parent_, slot_), +zmq::own_t::own_t (class ctx_t *parent_, uint32_t tid_) : + object_t (parent_, tid_), terminating (false), sent_seqnum (0), processed_seqnum (0), diff --git a/src/own.hpp b/src/own.hpp index d9ef1dd..7090d62 100644 --- a/src/own.hpp +++ b/src/own.hpp @@ -43,7 +43,7 @@ namespace zmq // The object is not living within an I/O thread. It has it's own // thread outside of 0MQ infrastructure. - own_t (class ctx_t *parent_, uint32_t slot_); + own_t (class ctx_t *parent_, uint32_t tid_); // The object is living within I/O thread. own_t (class io_thread_t *io_thread_, const options_t &options_); diff --git a/src/pair.cpp b/src/pair.cpp index 07fd1e8..6442b32 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -23,8 +23,8 @@ #include "err.hpp" #include "pipe.hpp" -zmq::pair_t::pair_t (class ctx_t *parent_, uint32_t slot_) : - socket_base_t (parent_, slot_), +zmq::pair_t::pair_t (class ctx_t *parent_, uint32_t tid_) : + socket_base_t (parent_, tid_), inpipe (NULL), outpipe (NULL), inpipe_alive (false), diff --git a/src/pair.hpp b/src/pair.hpp index e774db9..c644675 100644 --- a/src/pair.hpp +++ b/src/pair.hpp @@ -33,7 +33,7 @@ namespace zmq { public: - pair_t (class ctx_t *parent_, uint32_t slot_); + pair_t (class ctx_t *parent_, uint32_t tid_); ~pair_t (); // Overloads of functions from socket_base_t. diff --git a/src/pub.cpp b/src/pub.cpp index efb430e..84bd9e1 100644 --- a/src/pub.cpp +++ b/src/pub.cpp @@ -24,8 +24,8 @@ #include "msg_content.hpp" #include "pipe.hpp" -zmq::pub_t::pub_t (class ctx_t *parent_, uint32_t slot_) : - socket_base_t (parent_, slot_), +zmq::pub_t::pub_t (class ctx_t *parent_, uint32_t tid_) : + socket_base_t (parent_, tid_), active (0), terminating (false) { diff --git a/src/pub.hpp b/src/pub.hpp index 3fe82df..270bda5 100644 --- a/src/pub.hpp +++ b/src/pub.hpp @@ -31,7 +31,7 @@ namespace zmq { public: - pub_t (class ctx_t *parent_, uint32_t slot_); + pub_t (class ctx_t *parent_, uint32_t tid_); ~pub_t (); // Implementations of virtual functions from socket_base_t. diff --git a/src/pull.cpp b/src/pull.cpp index 1c9b48c..b85c3b5 100644 --- a/src/pull.cpp +++ b/src/pull.cpp @@ -22,8 +22,8 @@ #include "pull.hpp" #include "err.hpp" -zmq::pull_t::pull_t (class ctx_t *parent_, uint32_t slot_) : - socket_base_t (parent_, slot_), +zmq::pull_t::pull_t (class ctx_t *parent_, uint32_t tid_) : + socket_base_t (parent_, tid_), fq (this) { options.type = ZMQ_PULL; diff --git a/src/pull.hpp b/src/pull.hpp index 83eae68..cd598d6 100644 --- a/src/pull.hpp +++ b/src/pull.hpp @@ -30,7 +30,7 @@ namespace zmq { public: - pull_t (class ctx_t *parent_, uint32_t slot_); + pull_t (class ctx_t *parent_, uint32_t tid_); ~pull_t (); protected: diff --git a/src/push.cpp b/src/push.cpp index b9780e3..4013380 100644 --- a/src/push.cpp +++ b/src/push.cpp @@ -23,8 +23,8 @@ #include "err.hpp" #include "pipe.hpp" -zmq::push_t::push_t (class ctx_t *parent_, uint32_t slot_) : - socket_base_t (parent_, slot_), +zmq::push_t::push_t (class ctx_t *parent_, uint32_t tid_) : + socket_base_t (parent_, tid_), lb (this) { options.type = ZMQ_PUSH; diff --git a/src/push.hpp b/src/push.hpp index 447c3e2..d01e1ff 100644 --- a/src/push.hpp +++ b/src/push.hpp @@ -30,7 +30,7 @@ namespace zmq { public: - push_t (class ctx_t *parent_, uint32_t slot_); + push_t (class ctx_t *parent_, uint32_t tid_); ~push_t (); protected: diff --git a/src/rep.cpp b/src/rep.cpp index b564b2f..ddedbd9 100644 --- a/src/rep.cpp +++ b/src/rep.cpp @@ -22,8 +22,8 @@ #include "rep.hpp" #include "err.hpp" -zmq::rep_t::rep_t (class ctx_t *parent_, uint32_t slot_) : - xrep_t (parent_, slot_), +zmq::rep_t::rep_t (class ctx_t *parent_, uint32_t tid_) : + xrep_t (parent_, tid_), sending_reply (false), request_begins (true) { diff --git a/src/rep.hpp b/src/rep.hpp index b8cac98..17e2686 100644 --- a/src/rep.hpp +++ b/src/rep.hpp @@ -29,7 +29,7 @@ namespace zmq { public: - rep_t (class ctx_t *parent_, uint32_t slot_); + rep_t (class ctx_t *parent_, uint32_t tid_); ~rep_t (); // Overloads of functions from socket_base_t. diff --git a/src/req.cpp b/src/req.cpp index 491756b..5711f68 100644 --- a/src/req.cpp +++ b/src/req.cpp @@ -22,8 +22,8 @@ #include "req.hpp" #include "err.hpp" -zmq::req_t::req_t (class ctx_t *parent_, uint32_t slot_) : - xreq_t (parent_, slot_), +zmq::req_t::req_t (class ctx_t *parent_, uint32_t tid_) : + xreq_t (parent_, tid_), receiving_reply (false), message_begins (true) { diff --git a/src/req.hpp b/src/req.hpp index bb65006..b9ea401 100644 --- a/src/req.hpp +++ b/src/req.hpp @@ -29,7 +29,7 @@ namespace zmq { public: - req_t (class ctx_t *parent_, uint32_t slot_); + req_t (class ctx_t *parent_, uint32_t tid_); ~req_t (); // Overloads of functions from socket_base_t. diff --git a/src/socket_base.cpp b/src/socket_base.cpp index 36c7197..c6728fe 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -58,37 +58,37 @@ #include "uuid.hpp" zmq::socket_base_t *zmq::socket_base_t::create (int type_, class ctx_t *parent_, - uint32_t slot_) + uint32_t tid_) { socket_base_t *s = NULL; switch (type_) { case ZMQ_PAIR: - s = new (std::nothrow) pair_t (parent_, slot_); + s = new (std::nothrow) pair_t (parent_, tid_); break; case ZMQ_PUB: - s = new (std::nothrow) pub_t (parent_, slot_); + s = new (std::nothrow) pub_t (parent_, tid_); break; case ZMQ_SUB: - s = new (std::nothrow) sub_t (parent_, slot_); + s = new (std::nothrow) sub_t (parent_, tid_); break; case ZMQ_REQ: - s = new (std::nothrow) req_t (parent_, slot_); + s = new (std::nothrow) req_t (parent_, tid_); break; case ZMQ_REP: - s = new (std::nothrow) rep_t (parent_, slot_); + s = new (std::nothrow) rep_t (parent_, tid_); break; case ZMQ_XREQ: - s = new (std::nothrow) xreq_t (parent_, slot_); + s = new (std::nothrow) xreq_t (parent_, tid_); break; case ZMQ_XREP: - s = new (std::nothrow) xrep_t (parent_, slot_); + s = new (std::nothrow) xrep_t (parent_, tid_); break; case ZMQ_PULL: - s = new (std::nothrow) pull_t (parent_, slot_); + s = new (std::nothrow) pull_t (parent_, tid_); break; case ZMQ_PUSH: - s = new (std::nothrow) push_t (parent_, slot_); + s = new (std::nothrow) push_t (parent_, tid_); break; default: errno = EINVAL; @@ -98,8 +98,8 @@ zmq::socket_base_t *zmq::socket_base_t::create (int type_, class ctx_t *parent_, return s; } -zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t slot_) : - own_t (parent_, slot_), +zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_) : + own_t (parent_, tid_), ctx_terminated (false), destroyed (false), last_tsc (0), diff --git a/src/socket_base.hpp b/src/socket_base.hpp index ed28ba0..0fdfefd 100644 --- a/src/socket_base.hpp +++ b/src/socket_base.hpp @@ -46,7 +46,7 @@ namespace zmq // Create a socket of a specified type. static socket_base_t *create (int type_, class ctx_t *parent_, - uint32_t slot_); + uint32_t tid_); // Returns the signaler associated with this socket. signaler_t *get_signaler (); @@ -88,7 +88,7 @@ namespace zmq protected: - socket_base_t (class ctx_t *parent_, uint32_t slot_); + socket_base_t (class ctx_t *parent_, uint32_t tid_); virtual ~socket_base_t (); // Concrete algorithms for the x- methods are to be defined by diff --git a/src/sub.cpp b/src/sub.cpp index e2ccfc6..096fbc7 100644 --- a/src/sub.cpp +++ b/src/sub.cpp @@ -24,8 +24,8 @@ #include "sub.hpp" #include "err.hpp" -zmq::sub_t::sub_t (class ctx_t *parent_, uint32_t slot_) : - socket_base_t (parent_, slot_), +zmq::sub_t::sub_t (class ctx_t *parent_, uint32_t tid_) : + socket_base_t (parent_, tid_), fq (this), has_message (false), more (false) diff --git a/src/sub.hpp b/src/sub.hpp index cd656e9..3f8ced0 100644 --- a/src/sub.hpp +++ b/src/sub.hpp @@ -33,7 +33,7 @@ namespace zmq { public: - sub_t (class ctx_t *parent_, uint32_t slot_); + sub_t (class ctx_t *parent_, uint32_t tid_); ~sub_t (); protected: diff --git a/src/xrep.cpp b/src/xrep.cpp index 342c5ca..f6f8090 100644 --- a/src/xrep.cpp +++ b/src/xrep.cpp @@ -23,8 +23,8 @@ #include "err.hpp" #include "pipe.hpp" -zmq::xrep_t::xrep_t (class ctx_t *parent_, uint32_t slot_) : - socket_base_t (parent_, slot_), +zmq::xrep_t::xrep_t (class ctx_t *parent_, uint32_t tid_) : + socket_base_t (parent_, tid_), current_in (0), prefetched (false), more_in (false), diff --git a/src/xrep.hpp b/src/xrep.hpp index 4564194..8c2e683 100644 --- a/src/xrep.hpp +++ b/src/xrep.hpp @@ -38,7 +38,7 @@ namespace zmq { public: - xrep_t (class ctx_t *parent_, uint32_t slot_); + xrep_t (class ctx_t *parent_, uint32_t tid_); ~xrep_t (); // Overloads of functions from socket_base_t. diff --git a/src/xreq.cpp b/src/xreq.cpp index 884ed79..ce06d49 100644 --- a/src/xreq.cpp +++ b/src/xreq.cpp @@ -22,8 +22,8 @@ #include "xreq.hpp" #include "err.hpp" -zmq::xreq_t::xreq_t (class ctx_t *parent_, uint32_t slot_) : - socket_base_t (parent_, slot_), +zmq::xreq_t::xreq_t (class ctx_t *parent_, uint32_t tid_) : + socket_base_t (parent_, tid_), fq (this), lb (this) { diff --git a/src/xreq.hpp b/src/xreq.hpp index 5798fa9..c515905 100644 --- a/src/xreq.hpp +++ b/src/xreq.hpp @@ -31,7 +31,7 @@ namespace zmq { public: - xreq_t (class ctx_t *parent_, uint32_t slot_); + xreq_t (class ctx_t *parent_, uint32_t tid_); ~xreq_t (); protected: |