alsoInvalidate, alsoDoInvalidate, singleSuspend, factorySuspend

This commit is contained in:
InsanusMokrassar committed 2025-03-14 14:13:58 +06:00
1 parent a4c6c367e3
commit 831bf44e34
6 files changed
+86 -2

No files matched your search

@@ -7,7 +7,9 @@ fun <T> CoroutineScope.launchSynchronously(block: suspend CoroutineScope.() -> T
val objectToSynchronize = Object()
synchronized(objectToSynchronize) {
launch(start = CoroutineStart.UNDISPATCHED) {
result = safelyWithResult(block)
result = runCatching {
block()
}
}.invokeOnCompletion {
synchronized(objectToSynchronize) {
objectToSynchronize.notifyAll()