#include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include #include #include #define STACKSIZE 128 /* yeah */ #define REQ_EXIT 0 #define REQ_READ 1 #define REQ_WRITE 2 typedef struct { char stack[STACKSIZE]; } aio_thread; typedef struct { int type; aio_thread *thread; /* read/write */ int fd; off_t offset; size_t length; ssize_t done; int errorno; SV *data; void *dataptr; STRLEN offset; } aio_cb; typedef aio_cb *aio_req; static int started; static int reqpipe[2], respipe[2]; static void start_thread(void) { aio_thread *thr = NEW ( __clone (aio_proc, } static void end_thread(void) { aio_req req = 0; write (reqpipe[1], &req, sizeof (aio_req)); nthreads--; } MODULE = Linux::AIO PACKAGE = Linux::AIO BOOT: { if (pipe (reqpipe) || pipe (respipe)) croak ("unable to initialize request or result pipe"); } void min_parallel(nthreads) int nthreads CODE: while (nthreads > started) start_thread (); void max_parallel(nthreads) int nthreads CODE: while (started > nthreads) end_thread (); void read(fh,offset,length,data,dataoffset,callback) CODE: