summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2013-04-15 22:47:41 +0000
committerSteve Huston <shuston@riverace.com>2013-04-15 22:47:41 +0000
commit79c5e28ef730949f050ffce19d2486192e98715f (patch)
treeb4f8123dec6c0a0a535005fa87de7f82d13a5d0d
parent17de454ae447f29c05800dc1b21d831c7572003f (diff)
downloadATCD-79c5e28ef730949f050ffce19d2486192e98715f.tar.gz
ChangeLogTag:Mon Apr 15 22:45:14 UTC 2013 Steve Huston <shuston@riverace.com>
-rw-r--r--ChangeLog7
-rw-r--r--ace/Dev_Poll_Reactor.cpp44
-rw-r--r--ace/Dev_Poll_Reactor.h5
3 files changed, 32 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 2cadbfde3f5..d507770cab7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Apr 15 22:45:14 UTC 2013 Steve Huston <shuston@riverace.com>
+
+ * ace/Dev_Poll_Reactor.h:
+ * ace/Dev_Poll_Reactor.cpp: Changed the repository lock (repo_token_)
+ from an ACE_DEV_POLL_TOKEN to ACE_SYNCH_MUTEX and renamed it
+ repo_lock_. Gets a few more percent improvement in performance.
+
Mon Apr 15 14:28:43 UTC 2013 Steve Huston <shuston@riverace.com>
* ace/Dev_Poll_Reactor.cpp: Fixed single-threaded build issues.
diff --git a/ace/Dev_Poll_Reactor.cpp b/ace/Dev_Poll_Reactor.cpp
index d385330894f..85b2a2199ae 100644
--- a/ace/Dev_Poll_Reactor.cpp
+++ b/ace/Dev_Poll_Reactor.cpp
@@ -1172,7 +1172,7 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard)
int (ACE_Event_Handler::*callback)(ACE_HANDLE) = 0;
bool reactor_resumes_eh = false;
{
- ACE_GUARD_RETURN (ACE_DEV_POLL_TOKEN, grd, this->repo_token_, -1);
+ 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;
@@ -1295,7 +1295,7 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard)
// same handle/handler combination still.
if (reactor_resumes_eh)
{
- ACE_GUARD_RETURN (ACE_DEV_POLL_TOKEN, grd, this->repo_token_, -1);
+ 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);
@@ -1309,7 +1309,7 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard)
// 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_DEV_POLL_TOKEN, grd, this->repo_token_, 1);
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, 1);
info = this->handler_rep_.find (handle);
if (info != 0 && info->event_handler == eh)
{
@@ -1368,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_TOKEN, grd, this->repo_token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
return this->register_handler_i (handler->get_handle (),
handler,
@@ -1382,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_TOKEN, grd, this->repo_token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
return this->register_handler_i (handle,
event_handler,
@@ -1488,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_TOKEN, grd, this->repo_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,
@@ -1555,7 +1555,7 @@ ACE_Dev_Poll_Reactor::remove_handler (ACE_Event_Handler *handler,
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler");
- ACE_GUARD_RETURN (ACE_DEV_POLL_TOKEN, grd, this->repo_token_, -1);
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1);
return this->remove_handler_i (handler->get_handle (), mask, grd);
}
@@ -1565,7 +1565,7 @@ ACE_Dev_Poll_Reactor::remove_handler (ACE_HANDLE handle,
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler");
- ACE_GUARD_RETURN (ACE_DEV_POLL_TOKEN, grd, this->repo_token_, -1);
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1);
return this->remove_handler_i (handle, mask, grd);
}
@@ -1573,7 +1573,7 @@ ACE_Dev_Poll_Reactor::remove_handler (ACE_HANDLE handle,
int
ACE_Dev_Poll_Reactor::remove_handler_i (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
- ACE_Guard<ACE_DEV_POLL_TOKEN> &repo_guard,
+ ACE_Guard<ACE_SYNCH_MUTEX> &repo_guard,
ACE_Event_Handler *eh)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler_i");
@@ -1624,7 +1624,7 @@ ACE_Dev_Poll_Reactor::remove_handler (const ACE_Handle_Set &handle_set,
h != ACE_INVALID_HANDLE;
h = handle_iter ())
{
- ACE_GUARD_RETURN (ACE_DEV_POLL_TOKEN, grd, this->repo_token_, -1);
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1);
if (this->remove_handler_i (h, mask, grd) == -1)
return -1;
}
@@ -1681,7 +1681,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_TOKEN, grd, this->repo_token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
return this->suspend_handler_i (handle);
}
@@ -1691,7 +1691,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_TOKEN, grd, this->repo_token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
return this->suspend_handler_i (handle);
}
@@ -1704,7 +1704,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_TOKEN, grd, this->repo_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)
@@ -1718,7 +1718,7 @@ ACE_Dev_Poll_Reactor::suspend_handlers (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handlers");
- ACE_MT (ACE_GUARD_RETURN (ACE_DEV_POLL_TOKEN, grd, this->repo_token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
size_t const len = this->handler_rep_.max_size ();
@@ -1792,7 +1792,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_TOKEN, grd, this->repo_token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
return this->resume_handler_i (handle);
}
@@ -1802,7 +1802,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_TOKEN, grd, this->repo_token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
return this->resume_handler_i (handle);
}
@@ -1815,7 +1815,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_TOKEN, grd, this->repo_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)
@@ -1829,7 +1829,7 @@ ACE_Dev_Poll_Reactor::resume_handlers (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handlers");
- ACE_MT (ACE_GUARD_RETURN (ACE_DEV_POLL_TOKEN, grd, this->repo_token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
size_t const len = this->handler_rep_.max_size ();
@@ -2067,7 +2067,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_GUARD_RETURN (ACE_DEV_POLL_TOKEN, grd, this->repo_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)
@@ -2088,7 +2088,7 @@ ACE_Dev_Poll_Reactor::handler (ACE_HANDLE handle,
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::handler");
- ACE_MT (ACE_GUARD_RETURN (ACE_DEV_POLL_TOKEN, grd, this->repo_token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
Event_Tuple *info = this->handler_rep_.find (handle);
@@ -2224,7 +2224,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_TOKEN, grd, this->repo_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);
}
@@ -2236,7 +2236,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_TOKEN, grd, this->repo_token_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->repo_lock_, -1));
return this->mask_ops_i (handle, mask, ops);
}
diff --git a/ace/Dev_Poll_Reactor.h b/ace/Dev_Poll_Reactor.h
index 47e67593a18..fa67c02509e 100644
--- a/ace/Dev_Poll_Reactor.h
+++ b/ace/Dev_Poll_Reactor.h
@@ -975,7 +975,7 @@ protected:
//// callback it will be reacquired before return.
int remove_handler_i (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
- ACE_Guard<ACE_DEV_POLL_TOKEN> &repo_guard,
+ ACE_Guard<ACE_SYNCH_MUTEX> &repo_guard,
ACE_Event_Handler *eh = 0);
/// Temporarily remove the given handle from the "interest set."
@@ -1048,7 +1048,8 @@ protected:
/// Token used to protect manipulation of the handler repository.
/// No need to hold the waiter token to change the repo.
- ACE_DEV_POLL_TOKEN repo_token_;
+ // ACE_DEV_POLL_TOKEN repo_token_;
+ ACE_SYNCH_MUTEX repo_lock_;
/// The repository that contains all registered event handlers.
Handler_Repository handler_rep_;