summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2009-11-04 00:10:53 +0000
committerSteve Huston <shuston@riverace.com>2009-11-04 00:10:53 +0000
commit88b2d41b2a7a62ad7290f8f5957676ee50cbd48e (patch)
tree6638bd8505520704186624217a6b5130b19b28fe
parent0c80fc181376586f3ac2dca2ff71802bb778ed50 (diff)
downloadATCD-88b2d41b2a7a62ad7290f8f5957676ee50cbd48e.tar.gz
ChangeLogTag:Wed Nov 4 00:07:49 UTC 2009 Steve Huston <shuston@riverace.com>
-rw-r--r--ACE/ChangeLog7
-rw-r--r--ACE/ace/Dev_Poll_Reactor.cpp26
2 files changed, 22 insertions, 11 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index dc759cff87c..ac7e7bfc155 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,10 @@
+Wed Nov 4 00:07:49 UTC 2009 Steve Huston <shuston@riverace.com>
+
+ * ace/Dev_Poll_Reactor.cpp (resume_handler_i): If asked to resume a
+ handler without any bits currently set, just note the handler has
+ been resumed, don't fail it. Prevents orphaned handle if a
+ auto-suspended handler's callback clears the lone bit set.
+
Mon Nov 2 13:45:05 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl>
* ace/RW_Process_Mutex.h:
diff --git a/ACE/ace/Dev_Poll_Reactor.cpp b/ACE/ace/Dev_Poll_Reactor.cpp
index a49e9c40f4d..9f92f39a9f2 100644
--- a/ACE/ace/Dev_Poll_Reactor.cpp
+++ b/ACE/ace/Dev_Poll_Reactor.cpp
@@ -1269,13 +1269,7 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard)
// With epoll, events are registered with oneshot, so the handle is
// effectively suspended; future calls to epoll_wait() will select
// the next event, so they're not managed here.
- // The hitch to this is that the notify handler must always be resumed
- // immediately, before letting go of the guard. Else it's possible to
- // get into a state where all handles, including the notify pipe, are
- // suspended and that means the wait thread can't be interrupted.
info->suspended = true;
- if (eh == this->notify_handler_)
- this->resume_handler_i (handle);
#endif /* ACE_HAS_DEV_POLL */
int status = 0; // gets callback status, below.
@@ -1304,12 +1298,17 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard)
if (info != 0 && info->event_handler == eh)
{
if (status < 0)
- this->remove_handler_i (handle, disp_mask);
+ {
+ this->remove_handler_i (handle, disp_mask);
+ // Handler may be gone now; reset info w/ current status.
+ info = this->handler_rep_.find (handle);
+ }
#ifdef ACE_HAS_EVENT_POLL
// epoll-based effectively suspends handlers around the upcall.
// If the handler must be resumed here, do it now.
- if (info->suspended &&
+ if (info != 0 && info->event_handler == eh &&
+ info->suspended &&
(eh->resume_handler () ==
ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER))
this->resume_handler_i (handle);
@@ -1850,13 +1849,18 @@ ACE_Dev_Poll_Reactor::resume_handler_i (ACE_HANDLE handle)
ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler_i");
Event_Tuple *info = this->handler_rep_.find (handle);
- if (info == 0 || !info->suspended)
+ if (info == 0)
return -1;
- ACE_Reactor_Mask mask = info->mask;
+ if (!info->suspended)
+ return 0;
+ ACE_Reactor_Mask mask = info->mask;
if (mask == ACE_Event_Handler::NULL_MASK)
- return -1;
+ {
+ info->suspended = false;
+ return 0; // Nothing to do
+ }
// Place the handle back in to the "interest set."
//