Dex.Limiter.run_coroutine

### Method

# Dex Limiterrun_coroutine

unstable since: 1.2

#### Declaration [src]

    DexFuture*
    dex_limiter_run_coroutine (
      DexLimiter* limiter,
      DexScheduler* scheduler,
      DexCoroutineFunc func,
      gpointer user_data,
      GDestroyNotify user_data_destroy
    )

#### Description [src]

Runs `func` while holding one permit from `limiter`.

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.

Available since: 1.2

#### Parameters

`scheduler`

  Type: `DexScheduler`

  Scheduler to spawn `func` on, or `NULL` for the thread default.

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

`func`

  Type: `DexCoroutineFunc`

  Coroutine function to run after a permit is acquired.

`user_data`

  Type: `gpointer`

  Closure data for `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 spawned coroutine.

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