Skip to content

Commit fe64d7b

Browse files
committed
Mutex pseudo-constructor is replaced with top-level fun
1 parent 3638747 commit fe64d7b

File tree

1 file changed

+10
-2
lines changed
  • kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/sync

1 file changed

+10
-2
lines changed

kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/sync/Mutex.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ import kotlin.coroutines.experimental.startCoroutine
3636
public interface Mutex {
3737
/**
3838
* Factory for [Mutex] instances.
39+
* @suppress **Deprecated**
3940
*/
4041
public companion object Factory {
4142
/**
4243
* Creates new [Mutex] instance.
43-
* @param locked initial state of the mutex.
44+
* @suppress **Deprecated**
4445
*/
45-
public operator fun invoke(locked: Boolean = false) : Mutex = MutexImpl(locked)
46+
@Deprecated("Replaced with top-level function", level = DeprecationLevel.HIDDEN)
47+
public operator fun invoke(locked: Boolean = false): Mutex = Mutex(locked)
4648
}
4749

4850
/**
@@ -96,6 +98,12 @@ public interface Mutex {
9698
public fun unlock(owner: Any? = null)
9799
}
98100

101+
/**
102+
* Creates new [Mutex] instance.
103+
* @param locked initial state of the mutex.
104+
*/
105+
public fun Mutex(locked: Boolean = false): Mutex = MutexImpl(locked)
106+
99107
/**
100108
* Executes the given [action] under this mutex's lock.
101109
* @return the return value of the action.

0 commit comments

Comments
 (0)