summaryrefslogtreecommitdiff
path: root/gio/goutputstream.c
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2015-01-20 08:09:33 -0500
committerRyan Lortie <desrt@desrt.ca>2015-02-17 16:17:01 -0500
commitcb40c553aefff522cf3c6ff8af783afa3e217649 (patch)
tree013797a93fa64564aec90ea49882b6ffddb6d9b2 /gio/goutputstream.c
parentf56f1ef074c6043f505b05a4ca134c9ee2c717a1 (diff)
downloadglib-cb40c553aefff522cf3c6ff8af783afa3e217649.tar.gz
streams: add private 'async close via threads' API
Add an internal helper to find out if close_async() is implemented via threads using the default implementation in the base class. We will use this to decide if we should do a 'pure async' close of a GIOStream or not. https://bugzilla.gnome.org/show_bug.cgi?id=741630
Diffstat (limited to 'gio/goutputstream.c')
-rw-r--r--gio/goutputstream.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gio/goutputstream.c b/gio/goutputstream.c
index ea05b41bf..035465db3 100644
--- a/gio/goutputstream.c
+++ b/gio/goutputstream.c
@@ -1705,6 +1705,25 @@ g_output_stream_async_write_is_via_threads (GOutputStream *stream)
g_pollable_output_stream_can_poll (G_POLLABLE_OUTPUT_STREAM (stream))));
}
+/*< internal >
+ * g_output_stream_async_close_is_via_threads:
+ * @stream: output stream
+ *
+ * Checks if an output stream's close_async function uses threads.
+ *
+ * Returns: %TRUE if @stream's close_async function uses threads.
+ **/
+gboolean
+g_output_stream_async_close_is_via_threads (GOutputStream *stream)
+{
+ GOutputStreamClass *class;
+
+ g_return_val_if_fail (G_IS_OUTPUT_STREAM (stream), FALSE);
+
+ class = G_OUTPUT_STREAM_GET_CLASS (stream);
+
+ return class->close_async == g_output_stream_real_close_async;
+}
/********************************************
* Default implementation of async ops *