mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-06 07:58:44 +02:00
Support g_main_context_push_thread_default() in gio
GFile allows for the possibility that external implementations may not support thread-default contexts yet, via g_file_supports_thread_contexts(). GVolumeMonitor is not yet thread-default-context aware. Add a test program to verify that basic gio async ops work correctly in non-default contexts. http://bugzilla.gnome.org/show_bug.cgi?id=579984
This commit is contained in:
25
gio/gfile.c
25
gio/gfile.c
@@ -6751,5 +6751,30 @@ g_file_stop_mountable_finish (GFile *file,
|
||||
return (* iface->stop_mountable_finish) (file, result, error);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_file_supports_thread_contexts:
|
||||
* @file: a #GFile.
|
||||
*
|
||||
* Checks if @file supports <link
|
||||
* linkend="g-main-context-push-thread-default-context">thread-default
|
||||
* contexts</link>. If this returns %FALSE, you cannot perform
|
||||
* asynchronous operations on @file in a thread that has a
|
||||
* thread-default context.
|
||||
*
|
||||
* Returns: Whether or not @file supports thread-default contexts.
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
gboolean
|
||||
g_file_supports_thread_contexts (GFile *file)
|
||||
{
|
||||
GFileIface *iface;
|
||||
|
||||
g_return_val_if_fail (G_IS_FILE (file), FALSE);
|
||||
|
||||
iface = G_FILE_GET_IFACE (file);
|
||||
return iface->supports_thread_contexts;
|
||||
}
|
||||
|
||||
#define __G_FILE_C__
|
||||
#include "gioaliasdef.c"
|
||||
|
Reference in New Issue
Block a user