Re: Multi-threaded UI Freezes on GDK Call



Michael McCann wrote:
Michael R. Head wrote:
On Tue, 2007-12-18 at 17:14 -0500, Michael R. Head wrote:
I assume you meant

    g_threads_init();
    gdk_threads_init();
    gtk_init();
gdk_threads_enter();
    gtk_main();
    gdk_threads_leave();

right?
Yes, that is correct. :)
Does your special function take time to do its job? If so, then that
would be why. For example:

...
while(1) {
gdk_threads_enter();
sleep(1)
gdk_threads_leave();
sleep(10)
};
...

you'd freeze your app for a second every 10 seconds.



Ahh, ok. How else can I accomplish my goal, then? I need to give GTK the

Which goal? Describe what your app is supposed to do.

lock, as I'm calling GDK from another function not in the main GTK loop. I tried leaving out gdk_threads_enter()/leave() in the CPU-intensive function, but X gives me errors.

tom



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