mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 02:32:11 +01:00
Merge branch '2051-unix-output-stream-fsync' into 'master'
gunix{input|output}stream: Drop custom close_{async|finish}() methods Closes #2051 See merge request GNOME/glib!1401
This commit is contained in:
commit
28133feb4a
@ -103,14 +103,6 @@ static void g_unix_input_stream_skip_async (GInputStream *stream,
|
||||
static gssize g_unix_input_stream_skip_finish (GInputStream *stream,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
static void g_unix_input_stream_close_async (GInputStream *stream,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer data);
|
||||
static gboolean g_unix_input_stream_close_finish (GInputStream *stream,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
static gboolean g_unix_input_stream_pollable_can_poll (GPollableInputStream *stream);
|
||||
static gboolean g_unix_input_stream_pollable_is_readable (GPollableInputStream *stream);
|
||||
@ -134,8 +126,6 @@ g_unix_input_stream_class_init (GUnixInputStreamClass *klass)
|
||||
stream_class->skip_async = g_unix_input_stream_skip_async;
|
||||
stream_class->skip_finish = g_unix_input_stream_skip_finish;
|
||||
}
|
||||
stream_class->close_async = g_unix_input_stream_close_async;
|
||||
stream_class->close_finish = g_unix_input_stream_close_finish;
|
||||
|
||||
/**
|
||||
* GUnixInputStream:fd:
|
||||
@ -452,37 +442,6 @@ g_unix_input_stream_skip_finish (GInputStream *stream,
|
||||
/* TODO: Not implemented */
|
||||
}
|
||||
|
||||
static void
|
||||
g_unix_input_stream_close_async (GInputStream *stream,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
GError *error = NULL;
|
||||
|
||||
task = g_task_new (stream, cancellable, callback, user_data);
|
||||
g_task_set_source_tag (task, g_unix_input_stream_close_async);
|
||||
g_task_set_priority (task, io_priority);
|
||||
|
||||
if (g_unix_input_stream_close (stream, cancellable, &error))
|
||||
g_task_return_boolean (task, TRUE);
|
||||
else
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_unix_input_stream_close_finish (GInputStream *stream,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (g_task_is_valid (result, stream), FALSE);
|
||||
|
||||
return g_task_propagate_boolean (G_TASK (result), error);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_unix_input_stream_pollable_can_poll (GPollableInputStream *stream)
|
||||
{
|
||||
|
@ -102,14 +102,6 @@ static gboolean g_unix_output_stream_writev (GOutputStream *stream,
|
||||
static gboolean g_unix_output_stream_close (GOutputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
static void g_unix_output_stream_close_async (GOutputStream *stream,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer data);
|
||||
static gboolean g_unix_output_stream_close_finish (GOutputStream *stream,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
static gboolean g_unix_output_stream_pollable_can_poll (GPollableOutputStream *stream);
|
||||
static gboolean g_unix_output_stream_pollable_is_writable (GPollableOutputStream *stream);
|
||||
@ -133,8 +125,6 @@ g_unix_output_stream_class_init (GUnixOutputStreamClass *klass)
|
||||
stream_class->write_fn = g_unix_output_stream_write;
|
||||
stream_class->writev_fn = g_unix_output_stream_writev;
|
||||
stream_class->close_fn = g_unix_output_stream_close;
|
||||
stream_class->close_async = g_unix_output_stream_close_async;
|
||||
stream_class->close_finish = g_unix_output_stream_close_finish;
|
||||
|
||||
/**
|
||||
* GUnixOutputStream:fd:
|
||||
@ -539,37 +529,6 @@ g_unix_output_stream_close (GOutputStream *stream,
|
||||
return res != -1;
|
||||
}
|
||||
|
||||
static void
|
||||
g_unix_output_stream_close_async (GOutputStream *stream,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
GError *error = NULL;
|
||||
|
||||
task = g_task_new (stream, cancellable, callback, user_data);
|
||||
g_task_set_source_tag (task, g_unix_output_stream_close_async);
|
||||
g_task_set_priority (task, io_priority);
|
||||
|
||||
if (g_unix_output_stream_close (stream, cancellable, &error))
|
||||
g_task_return_boolean (task, TRUE);
|
||||
else
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_unix_output_stream_close_finish (GOutputStream *stream,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (g_task_is_valid (result, stream), FALSE);
|
||||
|
||||
return g_task_propagate_boolean (G_TASK (result), error);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_unix_output_stream_pollable_can_poll (GPollableOutputStream *stream)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user