/* When the operation is finished @callback will be called. You can then call g_output_stream_flush_finish() to get the result of the operation.  */
void g_output_stream_flush_async(GOutputStream *stream, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
/* When the operation is finished @callback will be called. You can then call g_output_stream_flush_finish() to get the result of the operation.  */
void g_output_stream_flush_async(GOutputStream *stream, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
{
  GOutputStreamClass *class;
  GTask *task;
  GError *error = NULL;
  g_return_if_fail (G_IS_OUTPUT_STREAM (stream));
  task = g_task_new (stream, cancellable, callback, user_data);
  g_task_set_source_tag (task, g_output_stream_flush_async);
  g_task_set_priority (task, io_priority);
  if (!g_output_stream_set_pending (stream, &error))
    {
      g_task_return_error (task, error);
      g_object_unref (task);
      return;
    }
  class = G_OUTPUT_STREAM_GET_CLASS (stream);
  if (class->flush_async == NULL)
    {
      g_task_return_boolean (task, TRUE);
      g_object_unref (task);
      return;
    }
  class->flush_async (stream, io_priority, cancellable,
                      async_ready_flush_callback_wrapper, task);
}