summaryrefslogtreecommitdiff
path: root/ace/Timer_Queue.cpp
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-04-22 08:15:21 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-04-22 08:15:21 +0000
commit69ece2d7d2b032c8ef6f827723874fb11b3b6ba7 (patch)
treeaff461430c99ded6240bc5cd2572d3c1c31e94c3 /ace/Timer_Queue.cpp
parent9f66663966051d24f2b41daca601ea0f19a52dce (diff)
downloadATCD-69ece2d7d2b032c8ef6f827723874fb11b3b6ba7.tar.gz
*** empty log message ***
Diffstat (limited to 'ace/Timer_Queue.cpp')
-rw-r--r--ace/Timer_Queue.cpp37
1 files changed, 32 insertions, 5 deletions
diff --git a/ace/Timer_Queue.cpp b/ace/Timer_Queue.cpp
index b5c9c964d12..e7342315f4d 100644
--- a/ace/Timer_Queue.cpp
+++ b/ace/Timer_Queue.cpp
@@ -3,6 +3,7 @@
#define ACE_BUILD_DLL
#include "ace/Timer_Queue.h"
+#include "ace/Strategies.h"
#if !defined (__ACE_INLINE__)
#include "ace/Timer_Queue.i"
@@ -108,9 +109,10 @@ ACE_Timer_Queue::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
-ACE_Timer_Queue::ACE_Timer_Queue (void)
+ACE_Timer_Queue::ACE_Timer_Queue (ACE_Upcall_Strategy *upcall_strategy)
: gettimeofday_ (ACE_OS::gettimeofday),
- timer_skew_ (0, ACE_TIMER_SKEW)
+ timer_skew_ (0, ACE_TIMER_SKEW),
+ upcall_strategy_ (upcall_strategy)
{
ACE_TRACE ("ACE_Timer_Queue::ACE_Timer_Queue");
}
@@ -160,9 +162,7 @@ ACE_Timer_Queue::expire (const ACE_Time_Value &cur_time)
reclaim = 0;
}
- // Perform the callback.
- if (handler->handle_timeout (cur_time, arg) == -1)
- this->cancel (handler, 0); // 0 means "call handle_close()".
+ this->upcall (handler, arg, cur_time);
if (reclaim)
// Call the factory method to free up the node.
@@ -174,6 +174,23 @@ ACE_Timer_Queue::expire (const ACE_Time_Value &cur_time)
return number_of_timers_expired;
}
+void
+ACE_Timer_Queue::upcall (ACE_Event_Handler *handler,
+ const void *arg,
+ const ACE_Time_Value &cur_time)
+{
+ if (this->upcall_strategy_ == 0)
+ {
+ // Perform the callback.
+ if (handler->handle_timeout (cur_time, arg) == -1)
+ this->cancel (handler, 0); // 0 means "call handle_close()".
+ }
+ else
+ // Pass the information along to the strategy
+ this->upcall_strategy_->upcall (handler, arg, cur_time);
+}
+
+
ACE_Time_Value
ACE_Timer_Queue::gettimeofday (void)
{
@@ -187,3 +204,13 @@ ACE_Timer_Queue::gettimeofday (ACE_Time_Value (*gettimeofday)(void))
gettimeofday_ = gettimeofday;
}
+#if defined (ACE_MT_SAFE)
+
+ACE_Recursive_Thread_Mutex &
+ACE_Timer_Queue::lock (void)
+{
+ return this->lock_;
+}
+
+#endif /* ACE_MT_SAFE */
+