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
Mutex API allows to pass an optional and arbitrary owner token to its methods, lock and unlock. This token can be used as a piece of additional debugging information to ensure Mutex ownership and catch programmatic errors early.
If a user tries to unlock a mutex with an owner different from the one it was locked with, the mutex will throw IllegalStateException.
Bug
The following call sequence is currently allowed by the implementation:
mutex.lock(someOwner)
mutex.unlock() // No owner at all
This behaviour becomes even trickier when the owner is operated as Any? in the user code, increasing the chances for null to sneak in.
Proposed change
Throw an IllegalStateException when no owner was supplied to unlock call for the mutex locked with the non-null owner.
The text was updated successfully, but these errors were encountered:
Background
Mutex
API allows to pass an optional and arbitraryowner
token to its methods,lock
andunlock
. This token can be used as a piece of additional debugging information to ensureMutex
ownership and catch programmatic errors early.If a user tries to unlock a mutex with an owner different from the one it was locked with, the mutex will throw
IllegalStateException
.Bug
The following call sequence is currently allowed by the implementation:
This behaviour becomes even trickier when the owner is operated as
Any?
in the user code, increasing the chances fornull
to sneak in.Proposed change
Throw an
IllegalStateException
when noowner
was supplied tounlock
call for the mutex locked with the non-null owner.The text was updated successfully, but these errors were encountered: