# launchSynchronously

fun < T > CoroutineScope. launchSynchronously (block: suspend CoroutineScope.() -> T ): T (source)

Launches a coroutine and blocks the current thread until the coroutine completes, returning its result. This is useful for bridging between suspending and non-suspending code in JVM environments. The coroutine is launched with CoroutineStart.UNDISPATCHED to start execution immediately.

#### Return

The result of the suspending block

#### Parameters

block

The suspending function to execute synchronously

#### Type Parameters

T

The return type of the suspending block

#### Throws

Throwable

if the coroutine throws an exception

fun < T > launchSynchronously (block: suspend CoroutineScope.() -> T ): T (source)

Launches a coroutine in a new CoroutineScope with Dispatchers.Default and blocks the current thread until the coroutine completes, returning its result.

#### Return

The result of the suspending block

#### Parameters

block

The suspending function to execute synchronously

#### Type Parameters

T

The return type of the suspending block

#### Throws

Throwable

if the coroutine throws an exception