Re: GUI freezes waiting for callback function to return



Hello,
Audio-recorder has couple of examples of g_timeout_add*() functions.
Ref: https://launchpad.net/audio-recorder

1) Look for:
$ grep -Ri g_timeout src/*.c

2) src/rec-manager.c uses also a GAsyncQueue. See:
   static GAsyncQueue *g_cmd_queue = NULL;
   g_cmd_queue = g_async_queue_new();

3) src/dbus-skype.c has an example of g_thread_try_new().
g_thread_try_new("Skype service thread", func, user_data, &error);

Threads cannot call GTK directly since gdk_threads_enter() / gdk_threads_leave
() was removed i GTK3.
Instead it (and all other modules) feed the message queue, and all is very
well.

My 5 cents.
Feliz Natal!


On Thu, Dec 13, 2012 at 2:59 PM, Osmo Antero <osmoma gmail com> wrote:

Hello,
Audio-recorder has couple of examples of g_timeout_add*() functions.
Ref: https://launchpad.net/audio-recorder

1) Look for:
$ grep -Ri g_timeout src/*.c

2) src/rec-manager.c uses also a GAsyncQueue.  See:
   static GAsyncQueue *g_cmd_queue = NULL;
   g_cmd_queue = g_async_queue_new();

3) src/dbus-skype.c has an example of g_thread_try_new().
g_thread_try_new("Skype service thread", func, user_data, &error);

Threads cannot call GTK directly since gdk_threads_enter() / gdk_threads_leave
() was removed i GTK3.
Instead it feeds the message queue, all is very well.

My 5 cents.
Feliz Natal!




-- 
// moma
   http://www.futuredesktop.org



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