diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-04 19:56:04 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-04 19:56:04 +0000 |
commit | 349626591b4feafa7e2a9f8926842ae596c4e3d2 (patch) | |
tree | 4a7b442695a03a6112f259455b2ec21e7ccea681 /ace/TP_Reactor.cpp | |
parent | aedcd1a28d47c7fb4cadca8b738d5e8cac72f728 (diff) | |
download | ATCD-349626591b4feafa7e2a9f8926842ae596c4e3d2.tar.gz |
Make sure <notify_handler_> never gets suspended without holding the <token_>.
Diffstat (limited to 'ace/TP_Reactor.cpp')
-rw-r--r-- | ace/TP_Reactor.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
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. |