diff options
author | Stefan Radomski <github@mintwerk.de> | 2016-06-18 11:55:39 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2016-06-18 11:55:39 (GMT) |
commit | 0e0be07906a720ae54e4572d6ac0cb657424550d (patch) | |
tree | 7d48c87a9142a5dad06570ca4daf0212475d83f1 /src/uscxml/interpreter/BasicEventQueue.cpp | |
parent | 84bbbd42c3480c40c0355c64899f99f8d588d5c0 (diff) | |
download | uscxml-0e0be07906a720ae54e4572d6ac0cb657424550d.zip uscxml-0e0be07906a720ae54e4572d6ac0cb657424550d.tar.gz uscxml-0e0be07906a720ae54e4572d6ac0cb657424550d.tar.bz2 |
Started to port Debugger and issue 87
Diffstat (limited to 'src/uscxml/interpreter/BasicEventQueue.cpp')
-rw-r--r-- | src/uscxml/interpreter/BasicEventQueue.cpp | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/uscxml/interpreter/BasicEventQueue.cpp b/src/uscxml/interpreter/BasicEventQueue.cpp index 7505f46..3cf4daf 100644 --- a/src/uscxml/interpreter/BasicEventQueue.cpp +++ b/src/uscxml/interpreter/BasicEventQueue.cpp @@ -37,24 +37,10 @@ Event BasicEventQueue::dequeue(size_t blockMs) { if (blockMs > 0) { // block for given milliseconds or until queue is filled - std::chrono::time_point<std::chrono::system_clock> updated, now; - std::chrono::milliseconds remain; + auto endTime = std::chrono::system_clock::now() + std::chrono::milliseconds(blockMs); - if (blockMs > (std::chrono::system_clock::duration::max)().count()) { - blockMs = (std::chrono::system_clock::duration::max)().count(); - } - - updated = now = std::chrono::system_clock::now(); - remain = std::chrono::milliseconds(blockMs); - - while (remain.count() > 0 && _queue.empty()) { - _cond.wait_for(_mutex, remain); - - now = std::chrono::system_clock::now(); - - auto elapsed = now - updated; - remain -= std::chrono::duration_cast<std::chrono::milliseconds>(elapsed); - updated = now; + while (_queue.empty()) { + _cond.wait_until(_mutex, endTime); } } |