Re: [gtk-win32] Updating a progress bar from a worker thread
- From: "John Emmas" <johne53 tiscali co uk>
- To: "Gtk+ on win32 platform packaging and distribution discussion" <gtk-win32-list gnome org>
- Subject: Re: [gtk-win32] Updating a progress bar from a worker thread
- Date: Sat, 19 Dec 2009 19:18:05 -0000
----- Original Message -----
From: "Tor Lillqvist"
Whoa, does this list still exist?
Wow, I see what you mean! I just took a look at the archive and realised
how lucky I was to get any replies!!
Anyway, without going into details (I must admit I am in a hurry now
and did not read your message thoroughly), you simply can't use GTK+
from multiple threads on Windows. That is a bug, yes, but it is one
that is quite hard to fix. Call gtk_* or gdk_* functions from just one
thread.
It's probably my fault but I think we're at crossed purposes here. All my
gtk and gdk functions are being called from the same thread (i.e. the main
UI thread) - but a worker thread is signalling the UI thread occasionally,
to tell it that something needs to be updated. The worker thread itself
doesn't contain any gtk or gdk code. That must be supported, surely?
Otherwise, gtk would be pretty useless for anything except the very simplest
of applications.
But in any case, I seem to have hit a much more fundamental problem....
From: "John Emmas"
I found the answer in a textbook!! After updating the progress bar I
needed to add these two lines to my loop:-
while (gtk_events_pending())
gtk_main_iteration();
Adding those lines does greatly improve the display performance but it
introduces a big problem of its own. If I repeatedly "waggle" my mouse
pointer while those lines are being processed (which presumably generates a
lot of events) the app simply crashes with Windows telling me (rather
unhelpfully) "Runtime Error: This application has asked the runtime to
terminate it in an unusual way" - and no further information..!
I haven't yet given this a great deal of thought but offhand, I can't think
of anything I could do to improve this.... :-(
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]