Support in the _async methods for clients that don't use a GMainLoop



Hey hackers,

I just added support to all _async implementations for applications that
will not use a GMainLoop.

I basically detect whether or not a mainloop is running in the thread
used to launch the _async method, and will or wont use a g_idle_add to
let the callback launch.

The detection happens using (g_main_depth () > 0). If there's no
GMainLoop available, the callback happens in the worker thread. Else the
callback happens in the GMainLoop (in the main thread of the app).

If that callback happens in the main thread, there's no need for
gdk_threads_enter or gdk_threads_leave. In Gtk+, it will always callback
that way. Other toolkits probably have their own thread-safety
instruments anyway.

Methods that support this:

  o. tny_folder_iface_refresh_async (TnyFolder)
  o. tny_folder_store_get_folders_async (TnyFolder & TnyStoreAccount)

-- 
Philip Van Hoof, software developer at x-tend 
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
work: vanhoof at x-tend dot be 
http://www.pvanhoof.be - http://www.x-tend.be




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]