You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Semaphore::release() is unchecked: stray releases lift the permit count above its initial value #424
Semaphore::release() is unchecked: releasing more often than acquiring pushes the permit count above the constructor's value, so the semaphore stops bounding concurrency.
Prints 3 for a Semaphore(1). A stray release() is a bug in the caller; the question is what the library should do: throw (Go's semaphore.Weighted panics on over-release), clamp at the initial count, or keep the permissive behaviour and document it (it is documented as unchecked today). Related: Mutex and Semaphore wake waiters in arrival order, but a newly arriving acquirer can take the permit before an awakened waiter, so there is no strict FIFO either.
Activity