Subject: Re: interrupting kevent()
To: Andrew Doran <>
From: Antti Kantee <>
List: tech-kern
Date: 10/23/2007 16:30:14
On Tue Oct 23 2007 at 14:23:40 +0100, Andrew Doran wrote:
> On Tue, Oct 23, 2007 at 03:45:49PM +0300, Antti Kantee wrote:
> > I have a dual eventloop/thread model and I need to interrupt the event
> > call from a thread sometimes.  I didn't find any sensible way of doing
> > this, so I added a KEVENT_TICKLE ioctl() to kqueue for interrupting
> > the wait.
> > 
> > Did I miss something or does the following look ok?
> Other ideas: use socketpair() or pthread_kill(thread, SIGIO).

I considered writing to a socket, but couldn't figure out how to do it
without having to drain the signal byte from the socket therefore taking
two syscalls for signalling instead of one.

Signals are problematic because they are global resources for a process
and this is a library.

Antti Kantee <>                     Of course he runs NetBSD                
    "la qualité la plus indispensable du cuisinier est l'exactitude"