gunix{input|output}stream: Drop custom close_{async|finish}() methods

They were not actually asynchronous, and hence caused blocking in the
main thread. Deleting them means the default implementation of those
vfuncs is used, which runs the sync implementation in a thread — which
is what is wanted here.

Spotted by Benjamin Otte.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #2051
This commit is contained in:
Philip Withnall 2020-03-02 13:52:56 +00:00
parent b3b814f9c2
commit 0a2dc161c0
2 changed files with 0 additions and 82 deletions

View File

@ -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)
{

View File

@ -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)
{