Re: Event loop processing in threads that must block
- From: Havoc Pennington <hp redhat com>
- To: Luciano Chavez <lnx1138 us ibm com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Event loop processing in threads that must block
- Date: 15 Nov 2001 12:33:11 -0500
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.
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.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]