Fix ConditionVariable#signal to only post if semaphore has waiters
This fixes a bug where calls to #signal would end up "over-posting" the semaphore, causing subsequent waits to return immediately until the semaphore value is back down to zero.
This commit is contained in:
1 parent
dddf0be4ef
commit
4518e6fdad
2 files changed
+17
-1
No files matched your search
@@ -16,7 +16,9 @@ module ProcessShared
|
||||
end
|
||||
|
||||
def signal
|
||||
@sem.post
|
||||
@internal.synchronize do
|
||||
@sem.post unless @waiting.read_int.zero?
|
||||
end
|
||||
end
|
||||
|
||||
def wait(mutex, timeout = nil)
|
||||
|
||||
Reference in new issue
Block a user