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:
Dan Winship
2009-06-16 20:22:58 -04:00
parent 4363f1932f
commit 65cc5d895a
23 changed files with 474 additions and 121 deletions

View File

@@ -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"