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.withLock() states that owner is an "optional owner token for debugging". However, it really uses it for consistency checks, e.g. curOwner !== owner in lockSuspend. This means that owner must be unique for each invocation of withLock(), otherwise one will get a cryptic IllegalStateException: Already locked by <owner>. The problem is that this contract isn't stated in the docs. Another problem is that using a debugging token for consistency checks doesn't look like a good idea.
The text was updated successfully, but these errors were encountered:
Either update the docs to state that owner must be unique for each concurrent invocation, or don't use it for consistency checks.
There are cases where "debugging token" is naturally derived from the operation that wants to take the lock, but its description can be non-unique. One might say that this is a problem with debugging, but in fact logging might use some other means to provide context, e.g. coroutines-aware context propagation.
Mutex.withLock()
states thatowner
is an "optional owner token for debugging". However, it really uses it for consistency checks, e.g.curOwner !== owner
inlockSuspend
. This means thatowner
must be unique for each invocation ofwithLock()
, otherwise one will get a crypticIllegalStateException: Already locked by <owner>
. The problem is that this contract isn't stated in the docs. Another problem is that using a debugging token for consistency checks doesn't look like a good idea.The text was updated successfully, but these errors were encountered: