diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2014-03-07 11:59:51 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2014-03-07 11:59:51 +0000 |
commit | 8d0b9152b1b1372faf08998de6d1e6d3e08d9037 (patch) | |
tree | 4778dd629b087981350bceeaa4a70e34b854b063 /ACE/ace/Timer_Queue_T.cpp | |
parent | da12fd62e56e7c9ce2d2ae27c7d28fb2fe92e918 (diff) | |
download | ATCD-8d0b9152b1b1372faf08998de6d1e6d3e08d9037.tar.gz |
Fri Mar 7 11:56:10 UTC 2014 Johnny Willemsen <jwillemsen@remedy.nl>
* ace/Timer_Queue_T.h:
* ace/Timer_Queue_T.inl:
* ace/Timer_Queue_T.cpp:
Moved the expire() method from the inline to the cpp, it is
virtual so can't be inlined. Further, the expire() method
had an optimization that it checked is_empty() before
callig the real expire that grabs the lock. This is causing
a potential data race because the timer hash overrides
is_empty
and uses a member variable to determine whether the queue
is empty or not, this is now accessed without having the
timer queue locked. Therefor the optimization was removed,
we directly call into the real expire that first grabs its
lock
Diffstat (limited to 'ACE/ace/Timer_Queue_T.cpp')
-rw-r--r-- | ACE/ace/Timer_Queue_T.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ACE/ace/Timer_Queue_T.cpp b/ACE/ace/Timer_Queue_T.cpp index 0b9b1dc7e3b..f392b6a8cdd 100644 --- a/ACE/ace/Timer_Queue_T.cpp +++ b/ACE/ace/Timer_Queue_T.cpp @@ -250,6 +250,16 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::schedule (const TYPE &t return result; } +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::expire (void) +{ + // We can't check here is the timer queue is empty, in some + // implementations (like the timer heap) calling is_empty() + // would at that moment access member variables without having + // locked ourself for thread safety + return this->expire (this->gettimeofday_static () + timer_skew_); +} + // Run the <handle_timeout> method for all Timers whose values are <= // <cur_time>. template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int |