diff options
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/thread.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/zencore/include/zencore/thread.h b/zencore/include/zencore/thread.h index 3c1821a62..2aad22061 100644 --- a/zencore/include/zencore/thread.h +++ b/zencore/include/zencore/thread.h @@ -161,13 +161,16 @@ public: } } - void Wait() + std::ptrdiff_t Remaining() const { return Counter.load(); } + + bool Wait(int TimeoutMs = -1) { std::ptrdiff_t Old = Counter.load(); - if (Old != 0) + if (Old == 0) { - Complete.Wait(); + return true; } + return Complete.Wait(TimeoutMs); } private: |