mirror of https://github.com/tasks/tasks
Make runBlocking crash when used on main thread
parent
e4b2dc932e
commit
a2776b960e
@ -0,0 +1,14 @@
|
||||
package org.tasks.data
|
||||
|
||||
import com.todoroo.andlib.utility.AndroidUtilities.assertNotMainThread
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
import kotlin.coroutines.EmptyCoroutineContext
|
||||
|
||||
@Throws(InterruptedException::class)
|
||||
fun <T> runBlocking(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> T): T {
|
||||
assertNotMainThread()
|
||||
|
||||
return kotlinx.coroutines.runBlocking(context, block)
|
||||
}
|
||||
|
Loading…
Reference in New Issue