ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/AIO.xs
(Generate patch)

Comparing IO-AIO/AIO.xs (file contents):
Revision 1.116 by root, Sat May 10 19:25:33 2008 UTC vs.
Revision 1.118 by root, Sun May 11 00:01:03 2008 UTC

12#include <sys/types.h> 12#include <sys/types.h>
13#include <sys/stat.h> 13#include <sys/stat.h>
14#include <limits.h> 14#include <limits.h>
15#include <fcntl.h> 15#include <fcntl.h>
16#include <sched.h> 16#include <sched.h>
17
18/* perl namespace pollution */
19#undef VERSION
17 20
18#ifdef _WIN32 21#ifdef _WIN32
19 22
20# define EIO_STRUCT_DIRENT Direntry_t 23# define EIO_STRUCT_DIRENT Direntry_t
21# undef malloc 24# undef malloc
101#include "libeio/eio.c" 104#include "libeio/eio.c"
102 105
103typedef eio_req *aio_req; 106typedef eio_req *aio_req;
104typedef eio_req *aio_req_ornot; 107typedef eio_req *aio_req_ornot;
105 108
106static int max_outstanding = 0; 109static SV *on_next_submit;
107
108static int next_pri = EIO_DEFAULT_PRI + EIO_PRI_BIAS; 110static int next_pri = EIO_DEFAULT_PRI + EIO_PRI_BIAS;
111static int max_outstanding;
109 112
110static int respipe_osf [2], respipe [2] = { -1, -1 }; 113static int respipe_osf [2], respipe [2] = { -1, -1 };
111 114
112static void req_destroy (aio_req req); 115static void req_destroy (aio_req req);
113static void req_cancel (aio_req req); 116static void req_cancel (aio_req req);
163 PUTBACK; 166 PUTBACK;
164 call_sv (grp->sv2, G_VOID | G_EVAL | G_KEEPERR); 167 call_sv (grp->sv2, G_VOID | G_EVAL | G_KEEPERR);
165 SPAGAIN; 168 SPAGAIN;
166 FREETMPS; 169 FREETMPS;
167 LEAVE; 170 LEAVE;
171 }
172}
173
174static void req_submit (eio_req *req)
175{
176 eio_submit (req);
177
178 if (on_next_submit)
179 {
180 dSP;
181 SV *cb = sv_2mortal (on_next_submit);
182
183 on_next_submit = 0;
184
185 PUSHMARK (SP);
186 PUTBACK;
187 call_sv (cb, G_DISCARD | G_EVAL);
168 } 188 }
169} 189}
170 190
171static int req_invoke (eio_req *req) 191static int req_invoke (eio_req *req)
172{ 192{
440 \ 460 \
441 req->callback = newSVsv (callback); \ 461 req->callback = newSVsv (callback); \
442 req->pri = req_pri 462 req->pri = req_pri
443 463
444#define REQ_SEND \ 464#define REQ_SEND \
445 eio_submit (req); \ 465 req_submit (req); \
446 \ 466 \
447 if (GIMME_V != G_VOID) \ 467 if (GIMME_V != G_VOID) \
448 XPUSHs (req_sv (req, AIO_REQ_KLASS)); 468 XPUSHs (req_sv (req, AIO_REQ_KLASS));
449 469
450MODULE = IO::AIO PACKAGE = IO::AIO 470MODULE = IO::AIO PACKAGE = IO::AIO
1003 RETVAL = started; 1023 RETVAL = started;
1004 if (WORDACCESS_UNSAFE) X_UNLOCK (wrklock); 1024 if (WORDACCESS_UNSAFE) X_UNLOCK (wrklock);
1005 OUTPUT: 1025 OUTPUT:
1006 RETVAL 1026 RETVAL
1007 1027
1028void _on_next_submit (SV *cb)
1029 CODE:
1030 SvREFCNT_dec (on_next_submit);
1031 on_next_submit = SvOK (cb) ? newSVsv (cb) : 0;
1032
1008PROTOTYPES: DISABLE 1033PROTOTYPES: DISABLE
1009 1034
1010MODULE = IO::AIO PACKAGE = IO::AIO::REQ 1035MODULE = IO::AIO PACKAGE = IO::AIO::REQ
1011 1036
1012void 1037void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines