Re: Handling Unix signals in a GTK+ application



Freddie Unpenstein wrote:

You are absolutely right; mutexes /are/ useless from signal

handlers. It seems the only reasonable way is to use a pipe().



How about GAsyncQueue's?  They're supposed to be thread safe without the need of locking...  How about within 
a single thread?



Add a unix signal number in the signal handler, and suck it out again in a custom event source's prepare 
method.  The prepare method can return -1 for its timeout contribution, and true/false if there's something 
in the queue.

So... poll *will* exit because of the signal... but will it check its event sources and everything... if no file descriptor is ready and timeout isnt reached ? you'll have to test it out with an idle main loop... because for the same reasons... you cant call
g_main_context_wakeup().

Cheers,
                                 -Tristan




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