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.124 by root, Thu May 29 03:20:40 2008 UTC vs.
Revision 1.127 by root, Tue Sep 30 13:17:32 2008 UTC

65# include <signal.h> 65# include <signal.h>
66# define EIO_STRUCT_DIRENT struct dirent 66# define EIO_STRUCT_DIRENT struct dirent
67 67
68#endif 68#endif
69 69
70/* perl stupidly overrides readdir and maybe others */
71/* with thread-unsafe versions, imagine that :( */
72#undef readdir
73#undef opendir
74#undef closedir
75
70#define EIO_STRUCT_STAT Stat_t 76#define EIO_STRUCT_STAT Stat_t
71 77
72/* use NV for 32 bit perls as it allows larger offsets */ 78/* use NV for 32 bit perls as it allows larger offsets */
73#if IVSIZE >= 8 79#if IVSIZE >= 8
74# define SvVAL64 SvIV 80# define SvVAL64 SvIV
75#else 81#else
76# define SvVAL64 SvNV 82# define SvVAL64 SvNV
77#endif 83#endif
84
85/*****************************************************************************/
86
87#if __GNUC__ >= 3
88# define expect(expr,value) __builtin_expect ((expr),(value))
89#else
90# define expect(expr,value) (expr)
91#endif
92
93#define expect_false(expr) expect ((expr) != 0, 0)
94#define expect_true(expr) expect ((expr) != 0, 1)
95
96/*****************************************************************************/
78 97
79static HV *stash; 98static HV *stash;
80typedef SV SV8; /* byte-sv, used for argument-checking */ 99typedef SV SV8; /* byte-sv, used for argument-checking */
81 100
82#define AIO_REQ_KLASS "IO::AIO::REQ" 101#define AIO_REQ_KLASS "IO::AIO::REQ"
175 194
176static void req_submit (eio_req *req) 195static void req_submit (eio_req *req)
177{ 196{
178 eio_submit (req); 197 eio_submit (req);
179 198
180 if (on_next_submit) 199 if (expect_false (on_next_submit))
181 { 200 {
182 dSP; 201 dSP;
183 SV *cb = sv_2mortal (on_next_submit); 202 SV *cb = sv_2mortal (on_next_submit);
184 203
185 on_next_submit = 0; 204 on_next_submit = 0;
458 \ 477 \
459 req->callback = newSVsv (callback); \ 478 req->callback = newSVsv (callback); \
460 req->pri = req_pri 479 req->pri = req_pri
461 480
462#define REQ_SEND \ 481#define REQ_SEND \
482 PUTBACK; \
463 req_submit (req); \ 483 req_submit (req); \
484 SPAGAIN; \
464 \ 485 \
465 if (GIMME_V != G_VOID) \ 486 if (GIMME_V != G_VOID) \
466 XPUSHs (req_sv (req, AIO_REQ_KLASS)); 487 XPUSHs (req_sv (req, AIO_REQ_KLASS));
467 488
468MODULE = IO::AIO PACKAGE = IO::AIO 489MODULE = IO::AIO PACKAGE = IO::AIO
888{ 909{
889 dREQ; 910 dREQ;
890 911
891 req->type = EIO_GROUP; 912 req->type = EIO_GROUP;
892 913
893 eio_submit (req); 914 req_submit (req);
894 XPUSHs (req_sv (req, AIO_GRP_KLASS)); 915 XPUSHs (req_sv (req, AIO_GRP_KLASS));
895} 916}
896 917
897void 918void
898aio_nop (SV *callback=&PL_sv_undef) 919aio_nop (SV *callback=&PL_sv_undef)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines