summaryrefslogtreecommitdiff
path: root/ACE/ace/Dev_Poll_Reactor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/ace/Dev_Poll_Reactor.cpp')
-rw-r--r--ACE/ace/Dev_Poll_Reactor.cpp314
1 files changed, 143 insertions, 171 deletions
diff --git a/ACE/ace/Dev_Poll_Reactor.cpp b/ACE/ace/Dev_Poll_Reactor.cpp
index 85b296e1849..ec0817a070b 100644
--- a/ACE/ace/Dev_Poll_Reactor.cpp
+++ b/ACE/ace/Dev_Poll_Reactor.cpp
@@ -279,7 +279,7 @@ int
ACE_Dev_Poll_Reactor_Notify::handle_input (ACE_HANDLE /*handle*/)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::handle_input");
- ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("SHOULD NOT BE HERE.\n")), -1);
+ ACELIB_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("SHOULD NOT BE HERE.\n")), -1);
}
ACE_HANDLE
@@ -331,7 +331,7 @@ ACE_Dev_Poll_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer)
break;
default:
// Should we bail out if we get an invalid mask?
- ACE_ERROR ((LM_ERROR,
+ ACELIB_ERROR ((LM_ERROR,
ACE_TEXT ("dispatch_notify invalid mask = %d\n"),
buffer.mask_));
}
@@ -386,12 +386,12 @@ ACE_Dev_Poll_Reactor_Notify::dump (void) const
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::dump");
- ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
- ACE_DEBUG ((LM_DEBUG,
+ ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+ ACELIB_DEBUG ((LM_DEBUG,
ACE_TEXT ("dp_reactor_ = %@"),
this->dp_reactor_));
this->notification_pipe_.dump ();
- ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
+ ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
@@ -582,17 +582,14 @@ ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor (ACE_Sig_Handler *sh,
: initialized_ (false)
, poll_fd_ (ACE_INVALID_HANDLE)
// , ready_set_ ()
-#if defined (ACE_HAS_EVENT_POLL)
- , epoll_wait_in_progress_ (false)
-#endif /* ACE_HAS_EVENT_POLL */
#if defined (ACE_HAS_DEV_POLL)
, dp_fds_ (0)
, start_pfds_ (0)
, end_pfds_ (0)
#endif /* ACE_HAS_DEV_POLL */
- , deactivated_ (0)
, token_ (*this, s_queue)
, lock_adapter_ (token_)
+ , deactivated_ (0)
, timer_queue_ (0)
, delete_timer_queue_ (false)
, signal_handler_ (0)
@@ -610,7 +607,7 @@ ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor (ACE_Sig_Handler *sh,
tq,
disable_notify_pipe,
notify) == -1)
- ACE_ERROR ((LM_ERROR,
+ ACELIB_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Dev_Poll_Reactor::open ")
ACE_TEXT ("failed inside ")
@@ -633,9 +630,9 @@ ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor (size_t size,
, start_pfds_ (0)
, end_pfds_ (0)
#endif /* ACE_HAS_DEV_POLL */
- , deactivated_ (0)
, token_ (*this, s_queue)
, lock_adapter_ (token_)
+ , deactivated_ (0)
, timer_queue_ (0)
, delete_timer_queue_ (false)
, signal_handler_ (0)
@@ -651,7 +648,7 @@ ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor (size_t size,
tq,
disable_notify_pipe,
notify) == -1)
- ACE_ERROR ((LM_ERROR,
+ ACELIB_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Dev_Poll_Reactor::open ")
ACE_TEXT ("failed inside ACE_Dev_Poll_Reactor::CTOR")));
@@ -941,33 +938,11 @@ ACE_Dev_Poll_Reactor::work_pending_i (ACE_Time_Value * max_wait_time)
#if defined (ACE_HAS_EVENT_POLL)
- // See if there are handlers that have to be resumed before waiting.
- {
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->to_be_resumed_lock_, -1);
- this->epoll_wait_in_progress_ = true;
- for (Resume_Map::iterator i = this->to_be_resumed_.begin ();
- i != this->to_be_resumed_.end ();
- ++i)
- {
- // Make sure that 1) the handle is still registered,
- // 2) the registered handler is the one we're waiting to resume.
- Event_Tuple *info = this->handler_rep_.find (i->first);
- if (info != 0 && info->event_handler == i->second)
- {
- this->resume_handler_i (i->first);
- }
- }
- this->to_be_resumed_.clear ();
- }
-
// Wait for an event.
int const nfds = ::epoll_wait (this->poll_fd_,
&this->event_,
1,
static_cast<int> (timeout));
- // Count on this being an atomic update; at worst, we may get an
- // extraneous notify() from dispatch_io_event.
- this->epoll_wait_in_progress_ = false;
#else
@@ -1042,7 +1017,7 @@ ACE_Dev_Poll_Reactor::handle_events_i (ACE_Time_Value *max_wait_time,
{
result = this->work_pending_i (max_wait_time);
if (result == -1 && (this->restart_ == 0 || errno != EINTR))
- ACE_ERROR ((LM_ERROR, ACE_TEXT("%t: %p\n"), ACE_TEXT("work_pending_i")));
+ ACELIB_ERROR ((LM_ERROR, ACE_TEXT("%t: %p\n"), ACE_TEXT("work_pending_i")));
}
while (result == -1 && this->restart_ != 0 && errno == EINTR);
@@ -1188,86 +1163,90 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard)
handler together with descriptor, instead of looking
it up in a repository ? Could it boost performance ?
*/
- Event_Tuple *info = this->handler_rep_.find (handle);
- if (info == 0) // No registered handler any longer
- {
-#ifdef ACE_HAS_EVENT_POLL
- this->event_.data.fd = ACE_INVALID_HANDLE; // Dump the event
-#endif /* ACE_HAS_EVENT_POLL */
- return 0;
- }
- // Figure out what to do first in order to make it easier to manage
- // the bit twiddling and possible pfds increment before releasing
- // the token for dispatch.
- // Note that if there's an error (such as the handle was closed
- // without being removed from the event set) the EPOLLHUP and/or
- // EPOLLERR bits will be set in revents.
+ // Going to access handler repo, so lock it. If the lock is
+ // unobtainable, something is very wrong so bail out.
+ Event_Tuple *info = 0;
ACE_Reactor_Mask disp_mask = 0;
- ACE_Event_Handler *eh = info->event_handler;
+ ACE_Event_Handler *eh = 0;
int (ACE_Event_Handler::*callback)(ACE_HANDLE) = 0;
- if (ACE_BIT_ENABLED (revents, out_event))
- {
- disp_mask = ACE_Event_Handler::WRITE_MASK;
- callback = &ACE_Event_Handler::handle_output;
- ACE_CLR_BITS (revents, out_event);
- }
- else if (ACE_BIT_ENABLED (revents, exc_event))
- {
- disp_mask = ACE_Event_Handler::EXCEPT_MASK;
- callback = &ACE_Event_Handler::handle_exception;
- ACE_CLR_BITS (revents, exc_event);
- }
- else if (ACE_BIT_ENABLED (revents, in_event))
- {
- disp_mask = ACE_Event_Handler::READ_MASK;
- callback = &ACE_Event_Handler::handle_input;
- ACE_CLR_BITS (revents, in_event);
- }
- else if (ACE_BIT_ENABLED (revents, err_event))
- {
- this->remove_handler_i (handle,
- ACE_Event_Handler::ALL_EVENTS_MASK,
- info->event_handler);
+ bool reactor_resumes_eh = false;
+ {
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1);
+ info = this->handler_rep_.find (handle);
+ if (info == 0) // No registered handler any longer
+ return 0;
+
+ // Figure out what to do first in order to make it easier to manage
+ // the bit twiddling and possible pfds increment before releasing
+ // the token for dispatch.
+ // Note that if there's an error (such as the handle was closed
+ // without being removed from the event set) the EPOLLHUP and/or
+ // EPOLLERR bits will be set in revents.
+ eh = info->event_handler;
+ if (ACE_BIT_ENABLED (revents, out_event))
+ {
+ disp_mask = ACE_Event_Handler::WRITE_MASK;
+ callback = &ACE_Event_Handler::handle_output;
+ ACE_CLR_BITS (revents, out_event);
+ }
+ else if (ACE_BIT_ENABLED (revents, exc_event))
+ {
+ disp_mask = ACE_Event_Handler::EXCEPT_MASK;
+ callback = &ACE_Event_Handler::handle_exception;
+ ACE_CLR_BITS (revents, exc_event);
+ }
+ else if (ACE_BIT_ENABLED (revents, in_event))
+ {
+ disp_mask = ACE_Event_Handler::READ_MASK;
+ callback = &ACE_Event_Handler::handle_input;
+ ACE_CLR_BITS (revents, in_event);
+ }
+ else if (ACE_BIT_ENABLED (revents, err_event))
+ {
+ this->remove_handler_i (handle,
+ ACE_Event_Handler::ALL_EVENTS_MASK,
+ grd,
+ info->event_handler);
#ifdef ACE_HAS_DEV_POLL
- ++pfds;
+ ++pfds;
#endif /* ACE_HAS_DEV_POLL */
- return 1;
- }
- else
- {
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("(%t) dispatch_io h %d unknown events 0x%x\n"),
- handle, revents));
- }
+ return 1;
+ }
+ else
+ {
+ ACELIB_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%t) dispatch_io h %d unknown events 0x%x\n"),
+ handle, revents));
+ }
#ifdef ACE_HAS_DEV_POLL
- // Increment the pointer to the next element before we
- // release the token. Otherwise event handlers end up being
- // dispatched multiple times for the same poll.
- if (revents == 0)
- ++pfds;
+ // Increment the pointer to the next element before we
+ // release the token. Otherwise event handlers end up being
+ // dispatched multiple times for the same poll.
+ if (revents == 0)
+ ++pfds;
#else
- // 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 is always registered
- // WITHOUT oneshot and is never suspended/resumed. This avoids endless
- // notify loops caused by the notify handler requiring a resumption
- // which requires the token, which requires a notify, etc. described
- // in Bugzilla 3714. So, never suspend the notify handler.
-
- bool reactor_resumes_eh = false;
- if (eh != this->notify_handler_)
- {
- info->suspended = true;
+ // 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 is always registered
+ // WITHOUT oneshot and is never suspended/resumed. This avoids endless
+ // notify loops caused by the notify handler requiring a resumption
+ // which requires the token, which requires a notify, etc. described
+ // in Bugzilla 3714. So, never suspend the notify handler.
+ if (eh != this->notify_handler_)
+ {
+ info->suspended = true;
- reactor_resumes_eh =
- eh->resume_handler () ==
- ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER;
- }
+ reactor_resumes_eh =
+ eh->resume_handler () ==
+ ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER;
+ }
#endif /* ACE_HAS_DEV_POLL */
+ } // End scope for ACE_GUARD holding repo lock
+
int status = 0; // gets callback status, below.
// Dispatch notifies directly. The notify dispatcher locates a
@@ -1305,10 +1284,6 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard)
// If the callback returned 0, epoll-based needs to resume the
// suspended handler but dev/poll doesn't.
- // The epoll case is optimized to not acquire the token in order
- // to resume the handler; the handler is added to a list of those
- // that need to be resumed and is handled by the next leader
- // that does an epoll_wait().
// In both epoll and dev/poll cases, if the callback returns <0,
// the token needs to be acquired and the handler checked and
// removed if it hasn't already been.
@@ -1316,34 +1291,30 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard)
{
#ifdef ACE_HAS_EVENT_POLL
// epoll-based effectively suspends handlers around the upcall.
- // If the handler must be resumed, add it to the list.
+ // If the handler must be resumed, check to be sure it's the
+ // same handle/handler combination still.
if (reactor_resumes_eh)
{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX,
- grd,
- this->to_be_resumed_lock_,
- -1);
- bool map_was_empty = this->to_be_resumed_.empty();
- this->to_be_resumed_.insert
- (Resume_Map::value_type (handle, eh));
- if (this->epoll_wait_in_progress_ && map_was_empty)
- this->notify();
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1);
+ info = this->handler_rep_.find (handle);
+ if (info != 0 && info->event_handler == eh)
+ this->resume_handler_i (handle);
}
#endif /* ACE_HAS_EVENT_POLL */
return 1;
}
// All state in the handler repository may have changed during the
- // upcall while other threads had the token. Thus, reacquire the
- // token and evaluate what's needed. If the upcalled handler is still
- // the handler of record for handle, continue with checking whether
- // or not to remove or resume the handler.
- guard.acquire ();
+ // upcall. Thus, reacquire the repo lock and evaluate what's needed.
+ // If the upcalled handler is still the handler of record for handle,
+ // continue with checking whether or not to remove or resume the
+ // handler.
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, 1);
info = this->handler_rep_.find (handle);
if (info != 0 && info->event_handler == eh)
{
if (status < 0)
- this->remove_handler_i (handle, disp_mask);
+ this->remove_handler_i (handle, disp_mask, grd);
}
}
// Scope close handles eh ref count decrement, if needed.
@@ -1397,7 +1368,7 @@ ACE_Dev_Poll_Reactor::register_handler (ACE_Event_Handler *handler,
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler");
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
return this->register_handler_i (handler->get_handle (),
handler,
@@ -1411,7 +1382,7 @@ ACE_Dev_Poll_Reactor::register_handler (ACE_HANDLE handle,
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler");
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
return this->register_handler_i (handle,
event_handler,
@@ -1456,7 +1427,7 @@ ACE_Dev_Poll_Reactor::register_handler_i (ACE_HANDLE handle,
if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1)
{
- ACE_ERROR ((LM_ERROR, ACE_TEXT("%p\n"), ACE_TEXT("epoll_ctl")));
+ ACELIB_ERROR ((LM_ERROR, ACE_TEXT("%p\n"), ACE_TEXT("epoll_ctl")));
(void) this->handler_rep_.unbind (handle);
return -1;
}
@@ -1470,7 +1441,7 @@ ACE_Dev_Poll_Reactor::register_handler_i (ACE_HANDLE handle,
// again, possibly for different event. Add new mask to the
// current one.
if (this->mask_ops_i (handle, mask, ACE_Reactor::ADD_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("%p\n"), ACE_TEXT("mask_ops_i")),
+ ACELIB_ERROR_RETURN ((LM_ERROR, ACE_TEXT("%p\n"), ACE_TEXT("mask_ops_i")),
-1);
}
@@ -1517,7 +1488,7 @@ ACE_Dev_Poll_Reactor::register_handler (const ACE_Handle_Set &handle_set,
ACE_Handle_Set_Iterator handle_iter (handle_set);
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
// @@ It might be more efficient to construct a pollfd array and
// pass it to the write () call in register_handler_i () only once,
@@ -1584,9 +1555,8 @@ ACE_Dev_Poll_Reactor::remove_handler (ACE_Event_Handler *handler,
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler");
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
-
- return this->remove_handler_i (handler->get_handle (), mask);
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1);
+ return this->remove_handler_i (handler->get_handle (), mask, grd);
}
int
@@ -1595,15 +1565,18 @@ ACE_Dev_Poll_Reactor::remove_handler (ACE_HANDLE handle,
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler");
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1);
- return this->remove_handler_i (handle, mask);
+ return this->remove_handler_i (handle, mask, grd);
}
+// FUZZ: disable check_for_ACE_Guard
int
ACE_Dev_Poll_Reactor::remove_handler_i (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
+ ACE_Guard<ACE_SYNCH_MUTEX> &repo_guard,
ACE_Event_Handler *eh)
+// FUZZ: enable check_for_ACE_Guard
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler_i");
@@ -1627,7 +1600,12 @@ ACE_Dev_Poll_Reactor::remove_handler_i (ACE_HANDLE handle,
ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
if (ACE_BIT_DISABLED (mask, ACE_Event_Handler::DONT_CALL))
- (void) eh->handle_close (handle, mask);
+ {
+ // It would be great if ACE_Reverse_Lock worked with the Guard.
+ repo_guard.release ();
+ eh->handle_close (handle, mask);
+ repo_guard.acquire ();
+ }
// If there are no longer any outstanding events on the given handle
// then remove it from the handler repository.
@@ -1644,20 +1622,14 @@ ACE_Dev_Poll_Reactor::remove_handler (const ACE_Handle_Set &handle_set,
ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler");
ACE_Handle_Set_Iterator handle_iter (handle_set);
-
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
-
- // @@ It might be more efficient to construct a pollfd array and
- // pass it to the write () call in register_handler_i () only once,
- // instead of calling write () (a system call) once for each file
- // descriptor.
-
for (ACE_HANDLE h = handle_iter ();
h != ACE_INVALID_HANDLE;
h = handle_iter ())
- if (this->remove_handler_i (h, mask) == -1)
- return -1;
-
+ {
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1);
+ if (this->remove_handler_i (h, mask, grd) == -1)
+ return -1;
+ }
return 0;
}
@@ -1711,7 +1683,7 @@ ACE_Dev_Poll_Reactor::suspend_handler (ACE_Event_Handler *event_handler)
ACE_HANDLE handle = event_handler->get_handle ();
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
return this->suspend_handler_i (handle);
}
@@ -1721,7 +1693,7 @@ ACE_Dev_Poll_Reactor::suspend_handler (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler");
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
return this->suspend_handler_i (handle);
}
@@ -1734,7 +1706,7 @@ ACE_Dev_Poll_Reactor::suspend_handler (const ACE_Handle_Set &handles)
ACE_Handle_Set_Iterator handle_iter (handles);
ACE_HANDLE h;
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
if (this->suspend_handler_i (h) == -1)
@@ -1748,7 +1720,7 @@ ACE_Dev_Poll_Reactor::suspend_handlers (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handlers");
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
size_t const len = this->handler_rep_.max_size ();
@@ -1822,7 +1794,7 @@ ACE_Dev_Poll_Reactor::resume_handler (ACE_Event_Handler *event_handler)
ACE_HANDLE handle = event_handler->get_handle ();
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
return this->resume_handler_i (handle);
}
@@ -1832,7 +1804,7 @@ ACE_Dev_Poll_Reactor::resume_handler (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler");
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
return this->resume_handler_i (handle);
}
@@ -1845,7 +1817,7 @@ ACE_Dev_Poll_Reactor::resume_handler (const ACE_Handle_Set &handles)
ACE_Handle_Set_Iterator handle_iter (handles);
ACE_HANDLE h;
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
if (this->resume_handler_i (h) == -1)
@@ -1859,7 +1831,7 @@ ACE_Dev_Poll_Reactor::resume_handlers (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handlers");
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
size_t const len = this->handler_rep_.max_size ();
@@ -1986,8 +1958,8 @@ ACE_Dev_Poll_Reactor::cancel_timer (ACE_Event_Handler *event_handler,
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_timer");
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
-
+ // Don't bother waking the poll - the worse that will happen is it will
+ // wake up for a timer that doesn't exist then go back to waiting.
return (this->timer_queue_ == 0
? 0
: this->timer_queue_->cancel (event_handler,
@@ -2001,8 +1973,8 @@ ACE_Dev_Poll_Reactor::cancel_timer (long timer_id,
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_timer");
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
-
+ // Don't bother waking the poll - the worse that will happen is it will
+ // wake up for a timer that doesn't exist then go back to waiting.
return (this->timer_queue_ == 0
? 0
: this->timer_queue_->cancel (timer_id,
@@ -2097,7 +2069,7 @@ ACE_Dev_Poll_Reactor::purge_pending_notifications (ACE_Event_Handler * eh,
ACE_Event_Handler *
ACE_Dev_Poll_Reactor::find_handler (ACE_HANDLE handle)
{
- ACE_MT (ACE_READ_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, 0));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, 0));
Event_Tuple *info = this->handler_rep_.find (handle);
if (info)
@@ -2118,7 +2090,7 @@ ACE_Dev_Poll_Reactor::handler (ACE_HANDLE handle,
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::handler");
- ACE_MT (ACE_READ_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
Event_Tuple *info = this->handler_rep_.find (handle);
@@ -2185,7 +2157,7 @@ ACE_Dev_Poll_Reactor::wakeup_all_threads (void)
// it.
this->notify (0,
ACE_Event_Handler::NULL_MASK,
- (ACE_Time_Value *) &ACE_Time_Value::zero);
+ (ACE_Time_Value *) &ACE_Time_Value::zero);
}
int
@@ -2254,7 +2226,7 @@ ACE_Dev_Poll_Reactor::mask_ops (ACE_Event_Handler *event_handler,
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::mask_ops");
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
return this->mask_ops_i (event_handler->get_handle (), mask, ops);
}
@@ -2266,7 +2238,7 @@ ACE_Dev_Poll_Reactor::mask_ops (ACE_HANDLE handle,
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::mask_ops");
- ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
return this->mask_ops_i (handle, mask, ops);
}
@@ -2434,17 +2406,17 @@ ACE_Dev_Poll_Reactor::dump (void) const
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Dev_Poll_Reactor::dump");
- ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("restart_ = %d\n"), this->restart_));
- ACE_DEBUG ((LM_DEBUG,
+ ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+ ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("restart_ = %d\n"), this->restart_));
+ ACELIB_DEBUG ((LM_DEBUG,
ACE_TEXT ("initialized_ = %d"),
this->initialized_));
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("poll_fd_ = %d"), this->poll_fd_));
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("size_ = %u"), this->handler_rep_.size ()));
- ACE_DEBUG ((LM_DEBUG,
+ ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("poll_fd_ = %d"), this->poll_fd_));
+ ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("size_ = %u"), this->handler_rep_.size ()));
+ ACELIB_DEBUG ((LM_DEBUG,
ACE_TEXT ("deactivated_ = %d"),
this->deactivated_));
- ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
+ ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
@@ -2532,7 +2504,7 @@ ACE_Dev_Poll_Reactor::Token_Guard::acquire_quietly (ACE_Time_Value *max_wait)
return 0;
else
{
- ACE_ERROR ((LM_ERROR, ACE_TEXT("%t: %p\n"), ACE_TEXT("token acquire_read")));
+ ACELIB_ERROR ((LM_ERROR, ACE_TEXT("%t: %p\n"), ACE_TEXT("token acquire_read")));
return -1;
}
}