On 2013-04-30 10:42, Patrick Ohly wrote:
In SyncEvolution, I am using a library with synchronous method calls which is unaware of glib. ... The real solution would be a g_main_loop_run_if_running() which atomically checks the flag and returns immediately if false. Is something like that possible with the current API, or are there other solutions to the problem?
Hi, I might not understand your situation fully, but in my code I've generally had a hard time doing anything with the glib main loop directly and have found it easier to find other ways to do things. In my case, I'm normally processing some data in a thread using library calls, then when it finishes I want to display the data to the user. For me, it's been easier to just save the data at the end of the thread (ignoring glib for the most part) then call gtk_widget_queue_draw in some thread-save way and let the main thread pick up the data next time it gets around to rendering. You might also want to take a look at GThreadPool's and GAsyncQueue's, if you haven't done so already. They can sometimes help avoid a few race conditions.
Attachment:
pgpP81SleoXLd.pgp
Description: PGP signature