Signal driven IO

Don Howard (dhoward@multitude.com)
Mon, 15 Nov 1999 13:20:32 -0800 (PST)


Here's a question about the sigwaitinfo-based IO mechanisim.

I've got a mutli-threaded app where one thread handles accept()ing new
connections and then distributes those connections to a pool of
workers. The accept() thread sets up async io on the socket and
assigns that socket to one of the woker threads via F_SETOWN

When I execute the program, I see SIGIO being delivered to the worker
thread, rather than the RT signal that I requested.

Is this a bug with my code, the kernel, or is it a just a feature
that I didn't expect?

[Accept thread]
fcntl (newsock, F_SETOWN, SOME_WORKER_PID); // Assign the new
// connetion to a worker.

fcntl (newsock, F_SETSIG, SOME_RT_SIG);

fcntl (newsock, F_SETFL, fcntl(F_GETFL) | O_NONBLOCK | O_ASYNC);

[Worker thread]
sigblock (SOME_RT_SIG);

while (1)
{
sigwaitinf ()
.
.
.
// do interesting things
}

-- 
Don Howard
dhoward@multitude.com 

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/