Method

DexLimiterrun_on_pool

unstable since: 1.2

Declaration [src]

DexFuture*
dex_limiter_run_on_pool (
  DexLimiter* limiter,
  DexThreadPool* pool,
  DexThreadFunc thread_func,
  gpointer user_data,
  GDestroyNotify user_data_destroy
)

Description [src]

Runs thread_func on pool while holding one permit from limiter.

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().

Available since: 1.2

Parameters

pool

Type: DexThreadPool

A DexThreadPool.

The data is owned by the caller of the method.
thread_func

Type: DexThreadFunc

function to run on pool after a permit is acquired.

user_data

Type: gpointer

Closure data for thread_func.

The argument can be NULL.
The data is owned by the caller of the method.
user_data_destroy

Type: GDestroyNotify

Destroy notify for user_data.

Return value

Type: DexFuture

A future representing the submitted work.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.