Re: Thread safety for epoll/libaio

Benjamin LaHaise
2006-03-01T02:33:04Z

On Tue, Feb 28, 2006 at 03:36:11PM -0500, Li, Peng wrote:
> I apologize if I should not post this on LKML, but there seems to be
> some lack of documentation for using epoll/AIO with threads. Are
> these interfaces thread-safe? Can I use them safely in the following
> way:

I can only speak for libaio, which is completely thread safe. Having a
single thread read events and dispatch is likely to work quite well given
the way the kernel interface is structured internally. There is still
room for improving the event mechanism to use a futex for waking so that
the library can parse multiple events from userspace, but that is pending
a heavier user like networking.

-ben
--
"Ladies and gentlemen, I'm sorry to interrupt, but the police are here
and they've asked us to stop the party." Don't Email: <dont@kvack.org>.