summaryrefslogtreecommitdiff
path: root/ace/TP_Reactor.cpp
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-01-28 02:31:31 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-01-28 02:31:31 +0000
commit77bf4e694ee0a47254089a732c0dfad82ac1bc7d (patch)
tree7cef0d395675e7cbda7be73dcec8e7f9914703b9 /ace/TP_Reactor.cpp
parent6a2338ef84011f5a83abf74c05d2086b6af01a88 (diff)
downloadATCD-77bf4e694ee0a47254089a732c0dfad82ac1bc7d.tar.gz
ChangeLogTag: Thu Jan 27 20:25:37 2000 Irfan Pyarali <irfan@cs.wustl.edu>
Diffstat (limited to 'ace/TP_Reactor.cpp')
-rw-r--r--ace/TP_Reactor.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/ace/TP_Reactor.cpp b/ace/TP_Reactor.cpp
index f8b0bca927b..fb961f28dd0 100644
--- a/ace/TP_Reactor.cpp
+++ b/ace/TP_Reactor.cpp
@@ -123,13 +123,32 @@ ACE_TP_Reactor::handle_events (ACE_Time_Value *max_wait_time)
// Try to grab the lock. If someone if already there, don't wake
// them up, just queue up in the thread pool.
int result = 0;
- ACE_MT (result = this->token_.acquire_read (&ACE_TP_Reactor::no_op_sleep_hook));
+
+ if (max_wait_time)
+ {
+ ACE_Time_Value tv = ACE_OS::gettimeofday ();
+ tv += *max_wait_time;
+
+ ACE_MT (result = this->token_.acquire_read (&ACE_TP_Reactor::no_op_sleep_hook,
+ 0,
+ &tv));
+ }
+ else
+ {
+ ACE_MT (result = this->token_.acquire_read (&ACE_TP_Reactor::no_op_sleep_hook));
+ }
+
+ // Update the countdown to reflect time waiting for the token.
+ countdown.update ();
+
switch (result)
{
case 2:
ACE_MT (this->token_.release ());
return 0;
case -1:
+ if (errno == ETIME)
+ return 0;
return -1;
}