run_on_pool


Description:

public Future run_on_pool (ThreadPool pool, owned ThreadFunc thread_func)

Runs thread_func on pool while holding one permit from this.

The returned future resolves or rejects with the result of the submitted thread-pool work. The permit is released automatically after the work resolves or rejects. If the returned future is discarded after the work is submitted to pool, the work is allowed to complete so that the permit can be released.

Workers in `DexThreadPool` are not scheduler threads, so thread_func must not use `dex_await()`.

Parameters:

this

a `DexLimiter`

pool

a `DexThreadPool`

thread_func

function to run on pool after a permit is acquired

user_data

closure data for thread_func

user_data_destroy

destroy notify for user_data

Returns:

a future representing the submitted work