apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil Conway <...@cs.berkeley.edu>
Subject Interrupt apr_socket_read()
Date Mon, 15 Jun 2009 04:14:54 GMT
In short, is there a sane way to interrupt a blocking
apr_socket_read() from another thread? apr_socket_read() apparently
swallows EINTR.

Context: I'm writing a daemon that assigns a thread to each client
connection. Most of the time, those threads will be blocked in recv(),
waiting for a new protocol command from their client. Occasionally,
I'd like one of these threads to respond to an externally-delivered
event (e.g. "clean up your state and shutdown cleanly"). I could
implement that by sending the thread a signal, but since
apr_socket_read() doesn't passthrough EINTR, that won't work.

One solution would be to use apr_poll(), which apparently doesn't
swallow EINTR. Would that be the best approach?

I'm new to APR, so perhaps I'm missing something obvious -- suggestions welcome!

Thanks in advance,

Neil

Mime
View raw message