Re: Multi-threaded UI Freezes on GDK Call



On Tue, Dec 18, 2007 at 07:05:18PM -0500, Michael McCann wrote:
Tomas Carnecky wrote:
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.

tom

I want to fix the issue of the UI freezing when the CPU-intensive 
function, which is on a separate thread and calls GDK, is executed.

Then put your CPU-intensive code on another proces an give data
back on a file descriptor when you are redy. This is the common
way to do it!


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

-- 
Göran Hasse

----------------------------------------------------------------
Göran Hasse            email: gh raditex se     Tel: 08-6949270
Raditex AB             http://www.raditex.se    
Planiavägen 15, 1tr                             Mob: 070-5530148
131 34  NACKA, SWEDEN                         OrgNr: 556240-0589
VAT: SE556240058901
------------------------------------------------------------------




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