From 3666a49022f84b3d1888f630a78f3f8f28aadde1 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Sat, 29 Aug 2009 10:32:21 +0200 Subject: bug in identifying current thread fixed --- src/app_thread.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/app_thread.cpp') diff --git a/src/app_thread.cpp b/src/app_thread.cpp index db73ec1..e4e5b19 100644 --- a/src/app_thread.cpp +++ b/src/app_thread.cpp @@ -44,7 +44,7 @@ zmq::app_thread_t::app_thread_t (dispatcher_t *dispatcher_, int thread_slot_) : object_t (dispatcher_, thread_slot_), - tid (0), + associated (false), last_processing_time (0) { } @@ -63,7 +63,8 @@ zmq::i_signaler *zmq::app_thread_t::get_signaler () bool zmq::app_thread_t::is_current () { - return !sockets.empty () && tid == getpid (); + return !sockets.empty () && associated && + thread_t::equal (tid, thread_t::id ()); } bool zmq::app_thread_t::make_current () @@ -73,7 +74,8 @@ bool zmq::app_thread_t::make_current () if (!sockets.empty ()) return false; - tid = getpid (); + associated = true; + tid = thread_t::id (); return true; } -- cgit v1.2.3