diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-01-10 09:24:12 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-01-10 09:24:12 +0000 |
commit | c4bf4bc99155df8414f63daa138879d8ccacb0f2 (patch) | |
tree | 6d48fd077ff8d56095bd11db2d9c2157ce93a0ac /cpp/src/IceGrid/WaitQueue.cpp | |
parent | file OpenSSLRuntime.ism was initially added on branch R3_0_branch. (diff) | |
download | ice-c4bf4bc99155df8414f63daa138879d8ccacb0f2.tar.bz2 ice-c4bf4bc99155df8414f63daa138879d8ccacb0f2.tar.xz ice-c4bf4bc99155df8414f63daa138879d8ccacb0f2.zip |
Added "always" activation mode.
Diffstat (limited to 'cpp/src/IceGrid/WaitQueue.cpp')
-rw-r--r-- | cpp/src/IceGrid/WaitQueue.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/cpp/src/IceGrid/WaitQueue.cpp b/cpp/src/IceGrid/WaitQueue.cpp index 6d7b058e6a4..7e8c9969155 100644 --- a/cpp/src/IceGrid/WaitQueue.cpp +++ b/cpp/src/IceGrid/WaitQueue.cpp @@ -58,7 +58,7 @@ WaitQueue::run() // // Notify expired items. // - while(!_waitQueue.empty()) + while(!_waitQueue.empty() && !_destroyed) { WaitItemPtr item = _waitQueue.front(); if(item->getExpirationTime() <= IceUtil::Time::now()) @@ -76,7 +76,7 @@ WaitQueue::run() // Wait until the next item expire or a notification. Note: in any case we // get out of this loop to get a chance to execute the work queue. // - timedWait(item->getExpirationTime() - IceUtil::Time::now()); + timedWait(item->getExpirationTime() - IceUtil::Time::now()); } } } @@ -97,6 +97,11 @@ WaitQueue::run() } } } + + if(_destroyed) + { + break; + } } if(!_waitQueue.empty()) @@ -134,26 +139,19 @@ WaitQueue::add(const WaitItemPtr& item, const IceUtil::Time& wait) // bool notifyThread = _waitQueue.empty(); - if(wait == IceUtil::Time::seconds(0)) - { - item->setExpirationTime(IceUtil::Time::now()); - } - else + IceUtil::Time expire = IceUtil::Time::now() + wait; + item->setExpirationTime(expire); + + list<WaitItemPtr>::iterator p = _waitQueue.begin(); + while(p != _waitQueue.end()) { - IceUtil::Time expire = IceUtil::Time::now() + wait; - item->setExpirationTime(expire); - - list<WaitItemPtr>::iterator p = _waitQueue.begin(); - while(p != _waitQueue.end()) + if((*p)->getExpirationTime() >= expire) { - if((*p)->getExpirationTime() >= expire) - { - break; - } - ++p; + break; } - _waitQueue.insert(p, item); + ++p; } + _waitQueue.insert(p, item); if(notifyThread) { |