summaryrefslogtreecommitdiff
path: root/ace/Proactor.cpp
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>2001-12-25 22:04:38 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>2001-12-25 22:04:38 +0000
commit1ef9c033ba58fdeca0ea84ecf2a076bc2db9caf0 (patch)
tree1416e1922b332266e85f298dc96441c3c96b5671 /ace/Proactor.cpp
parent23427ae73b4788c9dc15f6113bb7ebe5fa7b9d3d (diff)
downloadATCD-1ef9c033ba58fdeca0ea84ecf2a076bc2db9caf0.tar.gz
ChangeLogTag:Tue Dec 25 09:30:14 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
Diffstat (limited to 'ace/Proactor.cpp')
-rw-r--r--ace/Proactor.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/ace/Proactor.cpp b/ace/Proactor.cpp
index 22880a97363..4866480fda0 100644
--- a/ace/Proactor.cpp
+++ b/ace/Proactor.cpp
@@ -102,27 +102,35 @@ int
ACE_Proactor_Timer_Handler::svc (void)
{
ACE_Time_Value absolute_time;
+ ACE_Time_Value relative_time;
int empty_flag = 0;
int result = 0;
while (this->shutting_down_ == 0)
{
- // Is the timer queue empty?
- empty_flag = this->proactor_.timer_queue ()->is_empty ();
-
- if (!empty_flag)
+ // Check whether the timer queue has any items in it.
+ if (this->proactor_.timer_queue ()->is_empty () == 0)
{
// Get the earliest absolute time.
absolute_time = this->proactor_.timer_queue ()->earliest_time ();
- // Block for absolute time.
- result = this->timer_event_.wait (&absolute_time);
+ // Get current time from timer queue since we don't know
+ // which <gettimeofday> was used.
+ ACE_Time_Value cur_time = this->proactor_.timer_queue ()->gettimeofday ();
+
+ // Compare absolute time with curent time received from the
+ // timer queue.
+ if (absolute_time > cur_time)
+ relative_time = absolute_time - cur_time;
+ else
+ relative_time = 0;
+
+ // Block for relative time.
+ result = this->timer_event_.wait (&relative_time, 0);
}
else
- {
- // Wait for ever.
- result = this->timer_event_.wait ();
- }
+ // The timer queue has no entries, so wait indefinitely.
+ result = this->timer_event_.wait ();
// Check for timer expiries.
if (result == -1)