Gio.DBusConnection.flush

### Method

# Gio DBusConnectionflush

since: 2.26

#### Declaration [src]

    void
    g_dbus_connection_flush (
      GDBusConnection* connection,
      GCancellable* cancellable,
      GAsyncReadyCallback callback,
      gpointer user_data
    )

#### Description [src]

Asynchronously flushes `connection`, that is, writes all queued outgoing messages to the transport and then flushes the transport (using g_output_stream_flush_async()). This is useful in programs that want to emit a D-Bus signal and then exit immediately. Without flushing the connection, there is no guarantee that the message has been sent to the networking buffers in the OS kernel.

This is an asynchronous method. When the operation is finished, `callback` will be invoked in the thread-default main context (see `g_main_context_push_thread_default()`) of the thread you are calling this method from. You can then call `g_dbus_connection_flush_finish()` to get the result of the operation. See `g_dbus_connection_flush_sync()` for the synchronous version.

Available since: 2.26

This method completes asynchronously. Use `g_dbus_connection_flush_finish()` inside the `GAsyncReadyCallback` to obtain the result of the operation.

#### Parameters

`cancellable`

  Type: `GCancellable`

  A `GCancellable` or `NULL`.

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

`callback`

  Type: `GAsyncReadyCallback`

  A `GAsyncReadyCallback` to call when the request is satisfied or `NULL` if you don’t care about the result.

  The argument can be `NULL`.

`user_data`

  Type: `gpointer`

  The data to pass to `callback`.

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