Commit 9cfdb441 authored by Martin Sustrik's avatar Martin Sustrik

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: 's avatarMartin Sustrik <sustrik@250bpm.com>
parent 623a9c9f
......@@ -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++;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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.
......
......@@ -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_);
}
......@@ -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_);
......
......@@ -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),
......
......@@ -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_);
......
......@@ -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),
......
......@@ -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.
......
......@@ -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)
{
......
......@@ -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.
......
......@@ -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;
......
......@@ -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:
......
......@@ -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;
......
......@@ -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:
......
......@@ -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)
{
......
......@@ -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.
......
......@@ -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)
{
......
......@@ -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.
......
......@@ -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),
......
......@@ -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
......
......@@ -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)
......
......@@ -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:
......
......@@ -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),
......
......@@ -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.
......
......@@ -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)
{
......
......@@ -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:
......
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