On Sun, Jun 05, 2011 at 05:09:30PM -0400, Aaron Boxer <[email protected]> wrote: > Cool, thanks Marc. I will use libeio, in this case.
Or maybe not - a decade of use in production, but there still hasn't been an official release (we are curently preparing one though), so documentation is a bit scarse. > So, what libeio interface should I use for this? I won't need the mmap > functionality. For fadvise, you'd need to use eio_custom, or wait till it is implemented as separate request. There is an examplef or eio_custom in the manual: http://pod.tst.eu/http://cvs.schmorp.de/libeio/eio.pod#LIBEIO_SPECIFIC_REQUESTS As for integrating the libeio threadpool into an event loop (or not), see either the sparse docuemntation (you have to provide two callbacks that provide level-triggering). While you can't cancel fadvise calls that are in the kernel, cancelling a queued request will skip execution. Alternatively you could just look at the etp_ functions in the source and get inspired for your own threadpool. Things to watch out for are: - create threads with a blocked signal mask - don't bother with atfork and suff, newer posix versions made that useless - if you need many threads Otherwise, the libeio threadpool is a straightforward application of pthreads with condvars and some linked list stuff. Last not least, libglib has a portable thread pool API which you could use. Last I looked it is rather low-quality though, for example, it doesn't bother blocking signals, causing lots of issues. -- The choice of a Deliantra, the free code+content MORPG -----==- _GNU_ http://www.deliantra.net ----==-- _ generation ---==---(_)__ __ ____ __ Marc Lehmann --==---/ / _ \/ // /\ \/ / [email protected] -=====/_/_//_/\_,_/ /_/\_\ _______________________________________________ libev mailing list [email protected] http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
