run


Description:

public Future run (Scheduler? scheduler, size_t stack_size, owned FiberFunc func)

Runs func while holding one permit from this.

The returned future resolves or rejects with the result of the spawned fiber. The permit is released automatically after the fiber resolves or rejects. If the returned future is discarded after the fiber starts, the fiber 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

stack_size

stack size for the spawned fiber, or zero to use the default

func

fiber function to run after a permit is acquired

func_data

closure data for func

func_data_destroy

destroy notify for func_data

Returns:

a future representing the spawned fiber