vertx / io.vertx.kotlin.coroutines / awaitBlocking

awaitBlocking

suspend fun <T> awaitBlocking(block: () -> T): T

Run an asynchronous block on a worker threads and awaits the result.

The block is executed and should return an object or throw an exception.

val s = awaitBlocking {
  Thread.sleep(1000)
  "some-string"
}

The coroutine will be suspend until the block is executed, this action do not block vertx's eventLoop.

Parameters

block - the code to run