1 | #define PERL_NO_GET_CONTEXT |
|
|
2 | |
|
|
3 | #include "EXTERN.h" |
1 | #include "EXTERN.h" |
4 | #include "perl.h" |
2 | #include "perl.h" |
5 | #include "XSUB.h" |
3 | #include "XSUB.h" |
6 | |
4 | |
7 | #include <sys/types.h> |
5 | #include <sys/types.h> |
… | |
… | |
77 | |
75 | |
78 | select (respipe [0] + 1, &rfd, 0, 0, 0); |
76 | select (respipe [0] + 1, &rfd, 0, 0, 0); |
79 | } |
77 | } |
80 | |
78 | |
81 | static int |
79 | static int |
82 | poll_cb (pTHX) |
80 | poll_cb () |
83 | { |
81 | { |
84 | dSP; |
82 | dSP; |
85 | int count = 0; |
83 | int count = 0; |
86 | aio_req req; |
84 | aio_req req; |
87 | |
85 | |
… | |
… | |
227 | |
225 | |
228 | send_req (req); |
226 | send_req (req); |
229 | } |
227 | } |
230 | |
228 | |
231 | static void |
229 | static void |
232 | read_write (pTHX_ |
|
|
233 | int dowrite, int fd, off_t offset, size_t length, |
230 | read_write (int dowrite, int fd, off_t offset, size_t length, |
234 | SV *data, STRLEN dataoffset, SV *callback) |
231 | SV *data, STRLEN dataoffset, SV *callback) |
235 | { |
232 | { |
236 | aio_req req; |
233 | aio_req req; |
237 | STRLEN svlen; |
234 | STRLEN svlen; |
238 | char *svptr = SvPV (data, svlen); |
235 | char *svptr = SvPV (data, svlen); |
… | |
… | |
400 | } |
397 | } |
401 | |
398 | |
402 | while (started > nthreads) |
399 | while (started > nthreads) |
403 | { |
400 | { |
404 | poll_wait (); |
401 | poll_wait (); |
405 | poll_cb (aTHX); |
402 | poll_cb (); |
406 | } |
403 | } |
407 | } |
404 | } |
408 | |
405 | |
409 | int |
406 | int |
410 | max_outstanding(nreqs) |
407 | max_outstanding(nreqs) |
… | |
… | |
473 | SV * data |
470 | SV * data |
474 | IV dataoffset |
471 | IV dataoffset |
475 | SV * callback |
472 | SV * callback |
476 | PROTOTYPE: $$$$$$ |
473 | PROTOTYPE: $$$$$$ |
477 | CODE: |
474 | CODE: |
478 | read_write (aTHX_ 0, PerlIO_fileno (fh), offset, length, data, dataoffset, callback); |
475 | read_write (0, PerlIO_fileno (fh), offset, length, data, dataoffset, callback); |
479 | |
476 | |
480 | void |
477 | void |
481 | aio_write(fh,offset,length,data,dataoffset,callback) |
478 | aio_write(fh,offset,length,data,dataoffset,callback) |
482 | OutputStream fh |
479 | OutputStream fh |
483 | UV offset |
480 | UV offset |
… | |
… | |
485 | SV * data |
482 | SV * data |
486 | IV dataoffset |
483 | IV dataoffset |
487 | SV * callback |
484 | SV * callback |
488 | PROTOTYPE: $$$$$$ |
485 | PROTOTYPE: $$$$$$ |
489 | CODE: |
486 | CODE: |
490 | read_write (aTHX_ 1, PerlIO_fileno (fh), offset, length, data, dataoffset, callback); |
487 | read_write (1, PerlIO_fileno (fh), offset, length, data, dataoffset, callback); |
491 | |
488 | |
492 | void |
489 | void |
493 | aio_readahead(fh,offset,length,callback) |
490 | aio_readahead(fh,offset,length,callback) |
494 | InputStream fh |
491 | InputStream fh |
495 | UV offset |
492 | UV offset |
… | |
… | |
587 | |
584 | |
588 | int |
585 | int |
589 | poll_cb(...) |
586 | poll_cb(...) |
590 | PROTOTYPE: |
587 | PROTOTYPE: |
591 | CODE: |
588 | CODE: |
592 | RETVAL = poll_cb (aTHX); |
589 | RETVAL = poll_cb (); |
593 | OUTPUT: |
590 | OUTPUT: |
594 | RETVAL |
591 | RETVAL |
595 | |
592 | |
596 | void |
593 | void |
597 | poll_wait() |
594 | poll_wait() |