### Struct

# EDataServer AsyncClosure

since: 3.6

#### Description [src]

    struct EAsyncClosure {
      /* No available fields */
    }

`EAsyncClosure` provides a simple way to run an asynchronous function synchronously without blocking a running `GMainLoop` or using threads.

1) Create an `EAsyncClosure` with e_async_closure_new().

2) Call the asynchronous function passing `e_async_closure_callback()` as the `GAsyncReadyCallback` argument and the `EAsyncClosure` as the data argument.

3) Call `e_async_closure_wait()` and collect the `GAsyncResult`.

4) Call the corresponding asynchronous “finish” function, passing the `GAsyncResult` returned by e_async_closure_wait().

5) If needed, repeat steps 2-4 for additional asynchronous functions using the same `EAsyncClosure`.

6) Finally, free the `EAsyncClosure` with e_async_closure_free().

Available since: 3.6

#### Functions

###### e_async_closure_callback

Pass this function as the `GAsyncReadyCallback` argument of an asynchronous function, and the `EAsyncClosure` as the data argument.

since: 3.6

###### e_async_closure_new

Creates a new `EAsyncClosure` for use with asynchronous functions.

since: 3.6

###### e_async_closure_new_with_context

Creates a new `EAsyncClosure` for use with asynchronous functions using the `context` as the main context.

since: 3.40

#### Instance methods

###### e_async_closure_free

Frees the `closure` and the resources it holds.

since: 3.6

###### e_async_closure_wait

Call this function immediately after starting an asynchronous operation. The function waits for the asynchronous operation to complete and returns its `GAsyncResult` to be passed to the operation’s “finish” function.

since: 3.6