Re: Unix signals in GLib



On 2010-04-30 10:51, Stef Walter wrote:
> On 2010-04-30 08:53, Richard Hughes wrote:
>> On 30 April 2010 14:36, Stef Walter <stef-list memberwebs com> wrote:
>>> Remember that this doesn't work correctly in threaded apps, as we found
>>> in gnome-keyring-daemon. You have to do the strange
>>> signal-handling-thread-thing.
>>
>> Could you give more details please? Thanks.
> 
> For reasons that are almost, but not entirely, clear to me you have to:

Err, wait, that was slightly wrong... You need to:

 1. Block signals you're interested in on all threads, usually done
    early on, before starting any threads. Using pthread_sigmask.
 2. Create a new thread, and call sigwait in that thread on the
    interested signals, in a loop, handling signals as they come in.

> Code here:
> 
> http://git.gnome.org/browse/gnome-keyring/tree/daemon/gkd-main.c#n285

Cheers,

Stef


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