Thread safety for epoll/libaio
- From: "Li, Peng" <ringer9cs@xxxxxxxxx>
- Date: Tue, 28 Feb 2006 15:36:11 -0500
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Prev by Date: snd_intel8x0, 2.6.15.4: Alsa oss works, but pure alsa is way too fast
- Next by Date: Re: sg regression in 2.6.16-rc5
- Previous by thread: snd_intel8x0, 2.6.15.4: Alsa oss works, but pure alsa is way too fast
- Next by thread: NFS client hangs under certain circumstances on SMP machine
- Index(es):
Relevant Pages
- Re: security enhacement to C runtime library (XXX_s)
... possible, and a good idea, to make the user choose whether to use a safe ...
one could change the C compiler ... A guiding principle behind the recent "safer
interfaces" TR was not ... (comp.std.c) - Re: Are bad developer libraries the problem with M$ software?
... DR> It's hard to write secure applications when the interfaces ... DR>
available to developers don't provide what are considered to ... DR> be standard
and safe C library calls. ... (SecProg) - Re: Sorting strings in vbscript
... If looking for documentation on the net classes themselves ... but it
may be safe to assume the the interfaces to the classes will closely reflect the members
of the classes themselves). ... (microsoft.public.scripting.vbscript) - [PATCH 0/4] VFS fileop cleanups by collapsing AIO and vector IO
... These series of patches clean up and streamlines generic_file_* ... interfaces
in filemap.c. ... First patches collapses all the vectored IO support into ... Core
aio changes to support vectored AIO. ... (Linux-Kernel)