summaryrefslogtreecommitdiff
path: root/src/app_thread.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-02-08 18:37:48 +0100
committerMartin Sustrik <sustrik@250bpm.com>2010-02-08 18:37:48 +0100
commit01533a5aefb49e23be95cab9cfa5ca32cd438d25 (patch)
tree85ed3868c8973c13d3a1e90046427df7c3374421 /src/app_thread.cpp
parent7593d815ac57f2877480c5056b2f1aa65460f5c3 (diff)
ZMQII-65: Two OS threads are mapped to the same app_thread_t
Diffstat (limited to 'src/app_thread.cpp')
-rw-r--r--src/app_thread.cpp23
1 files changed, 4 insertions, 19 deletions
diff --git a/src/app_thread.cpp b/src/app_thread.cpp
index c55eb75..eff0cf7 100644
--- a/src/app_thread.cpp
+++ b/src/app_thread.cpp
@@ -62,7 +62,6 @@
zmq::app_thread_t::app_thread_t (dispatcher_t *dispatcher_, int thread_slot_,
int flags_) :
object_t (dispatcher_, thread_slot_),
- associated (false),
last_processing_time (0)
{
if (flags_ & ZMQ_POLL) {
@@ -87,24 +86,6 @@ zmq::i_signaler *zmq::app_thread_t::get_signaler ()
return signaler;
}
-bool zmq::app_thread_t::is_current ()
-{
- return !sockets.empty () && associated &&
- thread_t::equal (tid, thread_t::id ());
-}
-
-bool zmq::app_thread_t::make_current ()
-{
- // If there are object managed by this slot we cannot assign the slot
- // to a different thread.
- if (!sockets.empty ())
- return false;
-
- associated = true;
- tid = thread_t::id ();
- return true;
-}
-
void zmq::app_thread_t::process_commands (bool block_, bool throttle_)
{
uint64_t signals;
@@ -191,6 +172,8 @@ zmq::socket_base_t *zmq::app_thread_t::create_socket (int type_)
s = new (std::nothrow) downstream_t (this);
break;
default:
+ if (sockets.empty ())
+ dispatcher->no_sockets (this);
errno = EINVAL;
return NULL;
}
@@ -204,4 +187,6 @@ zmq::socket_base_t *zmq::app_thread_t::create_socket (int type_)
void zmq::app_thread_t::remove_socket (socket_base_t *socket_)
{
sockets.erase (socket_);
+ if (sockets.empty ())
+ dispatcher->no_sockets (this);
}