[lkml]   [2006]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRE: Thread safety for epoll/libaio

> 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:

They are thread safe.

> 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.

Using the interfaces this way is pretty much their entire point. They'd be
almost useless if you couldn't use them in this way.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-03-01 04:51    [W:0.077 / U:2.040 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site