### Class

# Dex Limiter

unstable since: 1.2

#### Description [src]

    final class Dex.Limiter : GObject.TypeInstance
    {
      /* No available fields */
    }

`DexLimiter` limits the number of operations running concurrently.

A limiter starts with a fixed number of permits. Use `dex_limiter_acquire()` and `dex_limiter_release()` directly when a permit must cover a custom scope, or use `dex_limiter_run()` or `dex_limiter_run_on_pool()` to acquire a permit and release it automatically when the work completes.

Available since: 1.2

#### Ancestors

- DexObject

#### Constructors

###### dex_limiter_new

Creates a new `DexLimiter` with `max_concurrency` permits.

unstable since: 1.2

#### Instance methods

###### dex_limiter_acquire

Acquires one permit from `limiter`.

unstable since: 1.2

###### dex_limiter_close

Closes `limiter`.

unstable since: 1.2

###### dex_limiter_close_after_drain

Closes `limiter` and waits for all queued and running work to complete.

unstable since: 1.2

###### dex_limiter_get_max_concurrency

Gets the maximum number of permits available from `limiter`.

unstable since: 1.2

###### dex_limiter_release

Releases one permit previously acquired from `limiter`.

unstable since: 1.2

###### dex_limiter_run

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

unstable since: 1.2

###### dex_limiter_run_coroutine

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

unstable since: 1.2

###### dex_limiter_run_on_pool

Runs `thread_func` on `pool` while holding one permit from `limiter`.

unstable since: 1.2

##### Methods inherited from DexObject (2)

###### dex_ref

Acquires a reference on the given object, and increases its reference count by one.

###### dex_unref

Releases a reference on the given object, and decreases its reference count by one.