A basic idea of threading GTK apps



Hi everybody,

I have at the moment, one big problem, which is trying to get GTK to work
in a threaded environment.

I have read the GTK FAQ included with my gtk distribution, (1.1.14), and I
need to base my code around the second idea put forward, that is, to have
one thread running GTK, (via the gtk_main() function I presume), and by
using mutexes to control access to the various GTK functions.

I can get one thread to run GTK, (it basically calls gtk_init() and
gtk_main()), which sets a variable so any other part of the program knows
that GTK is currently running. Now here's the main problem, I can get a
window displayed by doing the various GTK calls within the calling
program that started the gtk thread, (with me so far?), but as soon as I
try and move these functions to a separate thread, I get nothing on the
screen.

Can someone PLEASE give me some help on how to do this? I need to have a
program that starts a GTK thread, and then any other code to manipulate
GTK, (ie, create a new window), is in another separate thread. Basic code
examples, etc. would be a good plan.

Any help on this from anybody would be greatly appreciated, as the
software I am writing is for my University degree, so I really need it
to be fixed.

Thanks again for any help anyone can offer

Matt

PS. Could you possibly 'cc' any responses to my personal e-mail account,
which is md7141@bris.ac.uk, as that is checked more frequently.



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