New adventures in threading



Hi all,

Bet you can't guess I haven't done threading before? :) Sorry for all the
questions! Having solved my previous problems with a few more
gdk_threads_enter()/leave() I have a new problem.

The thread I spawn has a progress bar. I used to use
while(g_main_iteration(FALSE)); to handle these events (before it was
threaded). This has had to be removed as it causes problems with
gdk_thread_enter/leave again - appears to be deadlocking if I have this
between the thread statements! If I don't have it between the thread
statements then I get a lot of glib warnings as iterations are being done
out of the main loop.

Whilst I can use gtk_main to update the progress bar - the progress bar
appears well 5-10seconds before gtk_main is called and just sits there doing
nothing until then.

So I need a way to determine if gtk_main has been called or not - and if it
hasn't been called then I need to call g_main_iteration instead to make sure
it is updated. Best I have come up with so far is g_main_is_running(), but I
need to pass an argument to it....

Help!

Rich



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