public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Thread safety for epoll/libaio
@ 2006-02-28 20:36 Li, Peng
  2006-03-01  1:55 ` Anton Titov
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Li, Peng @ 2006-02-28 20:36 UTC (permalink / raw)
  To: Linux Kernel Mailing List

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:

Thread A:  while(1) { io_getevents();  ... }
// wait forever until an event occurs, then handles the event and loop

Thread B:  while(1) { epoll_wait();  ... }
// same as thread A

Thread C:  ... io_submit(); ...

Thread D:  ... epoll_ctl(); ....

Suppose thread B calls epoll_wait and blocks before thread D calls
epoll_ctl.  Is it safe to do so? Will thread B be notified for the
event submitted by thread D?  Thread A and C pose the same question
for AIO.

I wrote a simple program to test these interfaces and they seem to
work without problems, but I am not sure if it is really safe to do so
in general.  If all of them works, it seems easy to use epoll and AIO
together as I can simply use another thread to harvest events from
thread A and B and make it look like a unified event notification
interface.

Peng

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-03-01  3:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-28 20:36 Thread safety for epoll/libaio Li, Peng
2006-03-01  1:55 ` Anton Titov
2006-03-01  2:27 ` Benjamin LaHaise
2006-03-01  3:35 ` Phillip Susi
2006-03-01  3:48 ` David Schwartz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox