diff options
author | Robin Gareus <robin@gareus.org> | 2017-04-22 23:00:53 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-04-22 23:06:22 +0200 |
commit | 9c0ba3b3d53027f5c7c25341529562d41694ef2e (patch) | |
tree | f3fc1485bf84c2e8a556cc30f168e776ce4034e0 /libs/pbd/semutils.cc | |
parent | 629e6cbefb8ec2f3fa158879b9720433aaf3e8fd (diff) |
Add mechanism to reset/lock semaphores
Diffstat (limited to 'libs/pbd/semutils.cc')
-rw-r--r-- | libs/pbd/semutils.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libs/pbd/semutils.cc b/libs/pbd/semutils.cc index 7f31d30faf..496eaf4d91 100644 --- a/libs/pbd/semutils.cc +++ b/libs/pbd/semutils.cc @@ -74,4 +74,16 @@ Semaphore::wait () return (result == WAIT_OBJECT_0); } +int +Semaphore::reset () +{ + int rv = -1; + DWORD result; + do { + ++rv; + result = WaitForSingleObject(_sem, 0); + } while (result == WAIT_OBJECT_0); + return rv; +} + #endif |