Re: Event loop processing in threads that must block



On Thu, 2001-11-15 at 09:22, Havoc Pennington wrote:

Luciano Chavez <lnx1138 us ibm com> writes: 
Unfortunetly, some number of the time I did not initiate the API call
from a GTK+ signal handler and therefore running another main loop does
not work.

I don't understand this part - why doesn't it work?

Havoc

Havoc,

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 (). 

This is what I have tried in order to solve my problem but when one of
the threads calls gtk_main_quit, the other thread will eventually
segfault. I have placed gdk_thread_enter() and gdk_thread_leave() calls
around the loops but it doesn't seem to help.

The GTK FAQ only provides an example with one gtk_main call on the main
thread and two additional threads interleaving gtk_ calls while
protected these critical sections with gdk_thread_enter/leave calls.

Also, can you nest gdk_thread_enter/leave calls? Do they keep reference
counts so that the last leave does releases the gdk mutex?

-- 
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]