diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2010-04-29 01:17:09 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2010-04-29 01:17:09 +0000 |
| commit | f8bf9e0bfdde526ad2a2b5fb5d1f008ee51ac098 (patch) | |
| tree | 06356bde84fcb434ba53f1d766c89797f1ed33ad /cpp/src | |
| parent | 0112a080cc3063dd9d1d2ece2d711ba0becd95c2 (diff) | |
| download | qpid-python-f8bf9e0bfdde526ad2a2b5fb5d1f008ee51ac098.tar.gz | |
QPID-2186: Small adjustments to previous fix:
- Turn one of the "if"s into an assert
- Fix incorrect scope for unlocking Timer monitor around fire() callback.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@939156 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
| -rw-r--r-- | cpp/src/qpid/sys/Timer.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cpp/src/qpid/sys/Timer.cpp b/cpp/src/qpid/sys/Timer.cpp index 55c48c5b9c..26d16e5188 100644 --- a/cpp/src/qpid/sys/Timer.cpp +++ b/cpp/src/qpid/sys/Timer.cpp @@ -7,9 +7,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -84,7 +84,7 @@ Timer::Timer() : start(); } -Timer::~Timer() +Timer::~Timer() { stop(); } @@ -114,8 +114,10 @@ void Timer::run() } continue; } else if(Duration(t->nextFireTime, start) >= 0) { + { Monitor::ScopedUnlock u(monitor); fire(t); + } // Warn if callback overran next timer's start. AbsTime end(AbsTime::now()); Duration overrun (0); @@ -149,8 +151,8 @@ void Timer::run() tasks.push(t); } } - if (!tasks.empty()) - monitor.wait(tasks.top()->sortTime); + assert(!tasks.empty()); + monitor.wait(tasks.top()->sortTime); } } } |
