set
Atomically sets a default DispatcherProvider instance.
Samples
import dispatch.core.DefaultDispatcherProvider
import dispatch.core.DispatcherProvider
import dispatch.core.MainImmediateCoroutineScope
import dispatch.core.mainImmediateDispatcher
import dispatch.internal.test.Sample5
import io.kotest.matchers.shouldBe
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
import kotlinx.coroutines.newSingleThreadContext
import kotlinx.coroutines.test.resetMain
import kotlinx.coroutines.test.setMain
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.BeforeEach
fun main() {
//sampleStart
val custom = CustomDispatcherProvider()
DefaultDispatcherProvider.set(custom)
val scope = MainImmediateCoroutineScope()
scope.mainImmediateDispatcher shouldBe custom.mainImmediate
DefaultDispatcherProvider.get().mainImmediate shouldBe custom.mainImmediate
//sampleEnd
}