From 349626591b4feafa7e2a9f8926842ae596c4e3d2 Mon Sep 17 00:00:00 2001 From: nanbor Date: Sun, 4 Oct 1998 19:56:04 +0000 Subject: Make sure never gets suspended without holding the . --- ace/TP_Reactor.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'ace/TP_Reactor.cpp') diff --git a/ace/TP_Reactor.cpp b/ace/TP_Reactor.cpp index 9135f5cac37..f50449e9b98 100644 --- a/ace/TP_Reactor.cpp +++ b/ace/TP_Reactor.cpp @@ -59,7 +59,8 @@ ACE_TP_Reactor::notify_handle (ACE_EH_Dispatch_Info &dispatch_info) // assert (status >= 0); // resume in Reactor - return this->resume_handler (handle); + return (event_handler != this->notify_handler_ ? + this->resume_handler (handle) : 0); } // Overwrites ACE_Select_Reactor::dispatch_io_set() to *not* dispatch @@ -151,14 +152,20 @@ ACE_TP_Reactor::handle_events (ACE_Time_Value *max_wait_time) // Reset dispatch_info_ so that we don't trip over it again. this->dispatch_info_.reset (); - // Suspend the handler so that other thread don't start - // dispatching it. - result = this->suspend_i (dispatch_info.handle_); - if (result == -1) + if (dispatch_info.event_handler_ == this->notify_handler_) { + // Make sure we never suspend the notify_handler_ without holding the + // lock. + // @@ Actually, we don't even need to suspend the notify_handler_ + // here. But let me get it to work first. + int retv = this->notify_handle (dispatch_info); ACE_MT (this->token_.release ()); - return -1; + return retv; } + else + // Suspend the handler so that other thread don't start + // dispatching it. + result = this->suspend_i (dispatch_info.handle_); } // Release the lock. Others threads can start waiting. -- cgit v1.2.1