Re: Event loop processing in threads that must block
- From: Luciano Chavez <lnx1138 us ibm com>
- To: Havoc Pennington <hp redhat com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Event loop processing in threads that must block
- Date: 15 Nov 2001 12:26:03 -0600
On Thu, 2001-11-15 at 11:33, Havoc Pennington wrote:
Luciano Chavez <lnx1138 us ibm com> writes:
I apologize for the lack of clarity. Maybe I should ask simply, can I
execute gtk_main () on two separate threads or can there only be one
thread executing the gtk_main () event loop? I am not talking about
nested gtk_main () calls but independent threads calling gtk_main
().
Ah, no, you can't do that in GTK 1.2 I don't think. GTK 2.0 gives you
more flexibility (using the GLib-level main loop API).
A typical trick is to somehow get your UI action to happen in the main
thread, e.g. by queuing an idle function. Then you could block the
other thread (pthread_cond_wait?) and wake it up when gtk_main()
returns in the main thread.
Understood. That just sounds wacky enough to work. :-)
I'll give it a try when I get back to work on the messaging callback
code.
Also, can you nest gdk_thread_enter/leave calls? Do they keep reference
counts so that the last leave does releases the gdk mutex?
No, they aren't recursive.
Bummer. Coming from OS/2 development this sort of thing is taken for
granted. I'll be careful then using them.
Havoc
Thanks for the advice.
--
regards,
Luciano Chavez
lnx1138 us ibm com
http://sf.net/projects/evms
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]