run_coroutine


Description:

public Future run_coroutine (Scheduler? scheduler, owned CoroutineFunc func)

Runs func while holding one permit from this.

The returned future resolves or rejects with the result of the spawned coroutine. The permit is released automatically after the coroutine resolves or rejects. If the returned future is discarded after the coroutine starts, the coroutine is allowed to complete so that the permit can be released.

Parameters:

this

a `DexLimiter`

scheduler

scheduler to spawn func on, or null for the thread default

func

coroutine function to run after a permit is acquired

user_data

closure data for func

user_data_destroy

destroy notify for user_data

Returns:

a future representing the spawned coroutine