SokDoc

sok / Sok.Selector / Selector / setDefaultScope

setDefaultScope

fun setDefaultScope(scope: <ERROR CLASS>): Unit (source)

Platform and version requirements: Native

Bind the Selector to a particular CoroutineScope, mainly used in order to prevent the event loop from exiting while te selector is still running

exemple:

runBlocking(){
     Selector.setDefaultScope(this)
     //the runBlocking statement will now not return until the Selector.closeSelectorAndWait() method is called
}