-static void
-g_socket_output_stream_write_async (GOutputStream *stream,
- const void *buffer,
- gsize count,
- gint io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- GSocketOutputStream *output_stream = G_SOCKET_OUTPUT_STREAM (stream);
- GSource *source;
-
- g_assert (output_stream->priv->result == NULL);
-
- output_stream->priv->result =
- g_simple_async_result_new (G_OBJECT (stream), callback, user_data,
- g_socket_output_stream_write_async);
- if (cancellable)
- g_object_ref (cancellable);
- output_stream->priv->cancellable = cancellable;
- output_stream->priv->buffer = buffer;
- output_stream->priv->count = count;
-
- source = g_socket_create_source (output_stream->priv->socket,
- G_IO_OUT | G_IO_HUP | G_IO_ERR,
- cancellable);
- g_source_set_callback (source,
- (GSourceFunc) g_socket_output_stream_write_ready,
- g_object_ref (output_stream), g_object_unref);
- g_source_attach (source, g_main_context_get_thread_default ());
- g_source_unref (source);