Skip to content

Commit d1c8a3c

Browse files
Groostavelizarov
authored andcommitted
added note about FIFO order of Mutex.lock()
- Note that the OpenJDK [documents locks as "fair" when they release "the longest waiting thread"](https://github.com/openjdk-mirror/jdk7u-jdk/blob/master/src/share/classes/java/util/concurrent/locks/ReentrantLock.java#L55)
1 parent 1d6e493 commit d1c8a3c

File tree

1 file changed

+2
-0
lines changed
  • common/kotlinx-coroutines-core-common/src/sync

1 file changed

+2
-0
lines changed

common/kotlinx-coroutines-core-common/src/sync/Mutex.kt

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ public interface Mutex {
5656
* This function can be used in [select] invocation with [onLock] clause.
5757
* Use [tryLock] to try acquire lock without waiting.
5858
*
59+
* This function is fair; suspended callers are resumed in first-in-first-out order.
60+
*
5961
* @param owner Optional owner token for debugging. When `owner` is specified (non-null value) and this mutex
6062
* is already locked with the same token (same identity), this function throws [IllegalStateException].
6163
*/

0 commit comments

Comments
 (0)