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.69 by root, Tue Oct 24 11:57:30 2006 UTC vs.
Revision 1.74 by root, Wed Oct 25 17:57:30 2006 UTC

1/* solaris */
2#define _POSIX_PTHREAD_SEMANTICS 1
3
1#if __linux 4#if __linux
2# define _GNU_SOURCE 5# define _GNU_SOURCE
3#endif 6#endif
4 7
5#define _REENTRANT 1 8#define _REENTRANT 1
56 59
57/* buffer size for various temporary buffers */ 60/* buffer size for various temporary buffers */
58#define AIO_BUFSIZE 65536 61#define AIO_BUFSIZE 65536
59 62
60#define dBUF \ 63#define dBUF \
64 char *aio_buf; \
65 LOCK (wrklock); \
61 char *aio_buf = malloc (AIO_BUFSIZE); \ 66 self->dbuf = aio_buf = malloc (AIO_BUFSIZE); \
67 UNLOCK (wrklock); \
62 if (!aio_buf) \ 68 if (!aio_buf) \
63 return -1; 69 return -1;
64
65#define fBUF free (aio_buf)
66 70
67enum { 71enum {
68 REQ_QUIT, 72 REQ_QUIT,
69 REQ_OPEN, REQ_CLOSE, 73 REQ_OPEN, REQ_CLOSE,
70 REQ_READ, REQ_WRITE, REQ_READAHEAD, 74 REQ_READ, REQ_WRITE, REQ_READAHEAD,
124 128
125static int next_pri = DEFAULT_PRI + PRI_BIAS; 129static int next_pri = DEFAULT_PRI + PRI_BIAS;
126 130
127static int started, wanted; 131static int started, wanted;
128static volatile int nreqs; 132static volatile int nreqs;
129static int max_outstanding = 1<<30;
130static int respipe [2]; 133static int respipe [2];
131 134
132#if __linux && defined (PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP) 135#if __linux && defined (PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP)
133# define AIO_MUTEX_INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP 136# define AIO_MUTEX_INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
134#else 137#else
135# define AIO_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER 138# define AIO_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
136#endif 139#endif
140
141#define LOCK(mutex) pthread_mutex_lock (&(mutex))
142#define UNLOCK(mutex) pthread_mutex_unlock (&(mutex))
143
144/* worker threasd management */
145static pthread_mutex_t wrklock = AIO_MUTEX_INIT;
146
147typedef struct worker {
148 /* locked by wrklock */
149 struct worker *prev, *next;
150
151 pthread_t tid;
152
153 /* locked by reslock, reqlock or wrklock */
154 aio_req req; /* currently processed request */
155 void *dbuf;
156 DIR *dirp;
157} worker;
158
159static worker wrk_first = { &wrk_first, &wrk_first, 0 };
160
161static void worker_clear (worker *wrk)
162{
163 if (wrk->dirp)
164 {
165 closedir (wrk->dirp);
166 wrk->dirp = 0;
167 }
168
169 if (wrk->dbuf)
170 {
171 free (wrk->dbuf);
172 wrk->dbuf = 0;
173 }
174}
175
176static void worker_free (worker *wrk)
177{
178 wrk->next->prev = wrk->prev;
179 wrk->prev->next = wrk->next;
180
181 free (wrk);
182}
137 183
138static pthread_mutex_t reslock = AIO_MUTEX_INIT; 184static pthread_mutex_t reslock = AIO_MUTEX_INIT;
139static pthread_mutex_t reqlock = AIO_MUTEX_INIT; 185static pthread_mutex_t reqlock = AIO_MUTEX_INIT;
140static pthread_cond_t reqwait = PTHREAD_COND_INITIALIZER; 186static pthread_cond_t reqwait = PTHREAD_COND_INITIALIZER;
141 187
191 } 237 }
192 238
193 abort (); 239 abort ();
194} 240}
195 241
242static int poll_cb ();
196static void req_invoke (aio_req req); 243static void req_invoke (aio_req req);
197static void req_free (aio_req req); 244static void req_free (aio_req req);
245static void req_cancel (aio_req req);
198 246
199/* must be called at most once */ 247/* must be called at most once */
200static SV *req_sv (aio_req req, const char *klass) 248static SV *req_sv (aio_req req, const char *klass)
201{ 249{
202 if (!req->self) 250 if (!req->self)
271 fd_set rfd; 319 fd_set rfd;
272 320
273 while (nreqs) 321 while (nreqs)
274 { 322 {
275 int size; 323 int size;
276#if !(__i386 || __x86_64) /* safe without sempahore on this archs */ 324#if !(__i386 || __x86_64) /* safe without sempahore on these archs */
277 pthread_mutex_lock (&reslock); 325 LOCK (reslock);
278#endif 326#endif
279 size = res_queue.size; 327 size = res_queue.size;
280#if !(__i386 || __x86_64) /* safe without sempahore on this archs */ 328#if !(__i386 || __x86_64) /* safe without sempahore on these archs */
281 pthread_mutex_unlock (&reslock); 329 UNLOCK (reslock);
282#endif 330#endif
283 331
284 if (size) 332 if (size)
285 return; 333 return;
286 334
310 { 358 {
311 SV *rv = &PL_sv_undef; 359 SV *rv = &PL_sv_undef;
312 360
313 if (req->result >= 0) 361 if (req->result >= 0)
314 { 362 {
363 int i;
315 char *buf = req->data2ptr; 364 char *buf = req->data2ptr;
316 AV *av = newAV (); 365 AV *av = newAV ();
317 366
318 while (req->result) 367 av_extend (av, req->result - 1);
368
369 for (i = 0; i < req->result; ++i)
319 { 370 {
320 SV *sv = newSVpv (buf, 0); 371 SV *sv = newSVpv (buf, 0);
321 372
322 av_push (av, sv); 373 av_store (av, i, sv);
323 buf += SvCUR (sv) + 1; 374 buf += SvCUR (sv) + 1;
324 req->result--;
325 } 375 }
326 376
327 rv = sv_2mortal (newRV_noinc ((SV *)av)); 377 rv = sv_2mortal (newRV_noinc ((SV *)av));
328 } 378 }
329 379
413 SvREFCNT_dec (req->fh); 463 SvREFCNT_dec (req->fh);
414 SvREFCNT_dec (req->fh2); 464 SvREFCNT_dec (req->fh2);
415 SvREFCNT_dec (req->callback); 465 SvREFCNT_dec (req->callback);
416 Safefree (req->statdata); 466 Safefree (req->statdata);
417 467
418 if (req->type == REQ_READDIR && req->result >= 0) 468 if (req->type == REQ_READDIR)
419 free (req->data2ptr); 469 free (req->data2ptr);
420 470
421 Safefree (req); 471 Safefree (req);
422} 472}
423 473
474static void req_cancel_subs (aio_req grp)
475{
476 aio_req sub;
477
478 if (grp->type != REQ_GROUP)
479 return;
480
481 SvREFCNT_dec (grp->fh2);
482 grp->fh2 = 0;
483
484 for (sub = grp->grp_first; sub; sub = sub->grp_next)
485 req_cancel (sub);
486}
487
424static void req_cancel (aio_req req) 488static void req_cancel (aio_req req)
425{ 489{
426 req->flags |= FLAG_CANCELLED; 490 req->flags |= FLAG_CANCELLED;
427 491
428 if (req->type == REQ_GROUP) 492 req_cancel_subs (req);
429 {
430 aio_req sub;
431
432 for (sub = req->grp_first; sub; sub = sub->grp_next)
433 req_cancel (sub);
434 }
435} 493}
436 494
437static int poll_cb () 495static int poll_cb ()
438{ 496{
439 dSP; 497 dSP;
441 int do_croak = 0; 499 int do_croak = 0;
442 aio_req req; 500 aio_req req;
443 501
444 for (;;) 502 for (;;)
445 { 503 {
446 pthread_mutex_lock (&reslock); 504 LOCK (reslock);
447 req = reqq_shift (&res_queue); 505 req = reqq_shift (&res_queue);
448 506
449 if (req) 507 if (req)
450 { 508 {
451 if (!res_queue.size) 509 if (!res_queue.size)
455 while (read (respipe [0], buf, 32) == 32) 513 while (read (respipe [0], buf, 32) == 32)
456 ; 514 ;
457 } 515 }
458 } 516 }
459 517
460 pthread_mutex_unlock (&reslock); 518 UNLOCK (reslock);
461 519
462 if (!req) 520 if (!req)
463 break; 521 break;
464 522
465 --nreqs; 523 --nreqs;
500static void *aio_proc(void *arg); 558static void *aio_proc(void *arg);
501 559
502static void start_thread (void) 560static void start_thread (void)
503{ 561{
504 sigset_t fullsigset, oldsigset; 562 sigset_t fullsigset, oldsigset;
505 pthread_t tid;
506 pthread_attr_t attr; 563 pthread_attr_t attr;
564
565 worker *wrk = calloc (1, sizeof (worker));
566
567 if (!wrk)
568 croak ("unable to allocate worker thread data");
507 569
508 pthread_attr_init (&attr); 570 pthread_attr_init (&attr);
509 pthread_attr_setstacksize (&attr, STACKSIZE); 571 pthread_attr_setstacksize (&attr, STACKSIZE);
510 pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); 572 pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
511 573
512 sigfillset (&fullsigset); 574 sigfillset (&fullsigset);
575
576 LOCK (wrklock);
513 sigprocmask (SIG_SETMASK, &fullsigset, &oldsigset); 577 sigprocmask (SIG_SETMASK, &fullsigset, &oldsigset);
514 578
515 if (pthread_create (&tid, &attr, aio_proc, 0) == 0) 579 if (pthread_create (&wrk->tid, &attr, aio_proc, (void *)wrk) == 0)
580 {
581 wrk->prev = &wrk_first;
582 wrk->next = wrk_first.next;
583 wrk_first.next->prev = wrk;
584 wrk_first.next = wrk;
516 started++; 585 started++;
586 }
587 else
588 free (wrk);
517 589
518 sigprocmask (SIG_SETMASK, &oldsigset, 0); 590 sigprocmask (SIG_SETMASK, &oldsigset, 0);
591 UNLOCK (wrklock);
519} 592}
520 593
521static void req_send (aio_req req) 594static void req_send (aio_req req)
522{ 595{
523 while (started < wanted && nreqs >= started) 596 while (started < wanted && nreqs >= started)
524 start_thread (); 597 start_thread ();
525 598
526 ++nreqs; 599 ++nreqs;
527 600
528 pthread_mutex_lock (&reqlock); 601 LOCK (reqlock);
529 reqq_push (&req_queue, req); 602 reqq_push (&req_queue, req);
530 pthread_cond_signal (&reqwait); 603 pthread_cond_signal (&reqwait);
531 pthread_mutex_unlock (&reqlock); 604 UNLOCK (reqlock);
532
533 if (nreqs > max_outstanding)
534 for (;;)
535 {
536 poll_cb ();
537
538 if (nreqs <= max_outstanding)
539 break;
540
541 poll_wait ();
542 }
543} 605}
544 606
545static void end_thread (void) 607static void end_thread (void)
546{ 608{
547 aio_req req; 609 aio_req req;
609static ssize_t pread (int fd, void *buf, size_t count, off_t offset) 671static ssize_t pread (int fd, void *buf, size_t count, off_t offset)
610{ 672{
611 ssize_t res; 673 ssize_t res;
612 off_t ooffset; 674 off_t ooffset;
613 675
614 pthread_mutex_lock (&preadwritelock); 676 LOCK (preadwritelock);
615 ooffset = lseek (fd, 0, SEEK_CUR); 677 ooffset = lseek (fd, 0, SEEK_CUR);
616 lseek (fd, offset, SEEK_SET); 678 lseek (fd, offset, SEEK_SET);
617 res = read (fd, buf, count); 679 res = read (fd, buf, count);
618 lseek (fd, ooffset, SEEK_SET); 680 lseek (fd, ooffset, SEEK_SET);
619 pthread_mutex_unlock (&preadwritelock); 681 UNLOCK (preadwritelock);
620 682
621 return res; 683 return res;
622} 684}
623 685
624static ssize_t pwrite (int fd, void *buf, size_t count, off_t offset) 686static ssize_t pwrite (int fd, void *buf, size_t count, off_t offset)
625{ 687{
626 ssize_t res; 688 ssize_t res;
627 off_t ooffset; 689 off_t ooffset;
628 690
629 pthread_mutex_lock (&preadwritelock); 691 LOCK (preadwritelock);
630 ooffset = lseek (fd, 0, SEEK_CUR); 692 ooffset = lseek (fd, 0, SEEK_CUR);
631 lseek (fd, offset, SEEK_SET); 693 lseek (fd, offset, SEEK_SET);
632 res = write (fd, buf, count); 694 res = write (fd, buf, count);
633 lseek (fd, offset, SEEK_SET); 695 lseek (fd, offset, SEEK_SET);
634 pthread_mutex_unlock (&preadwritelock); 696 UNLOCK (preadwritelock);
635 697
636 return res; 698 return res;
637} 699}
638#endif 700#endif
639 701
655 pread (fd, aio_buf, len, offset); 717 pread (fd, aio_buf, len, offset);
656 offset += len; 718 offset += len;
657 count -= len; 719 count -= len;
658 } 720 }
659 721
660 fBUF;
661
662 errno = 0; 722 errno = 0;
663} 723}
664#endif 724#endif
665 725
666#if !HAVE_READDIR_R 726#if !HAVE_READDIR_R
671static int readdir_r (DIR *dirp, struct dirent *ent, struct dirent **res) 731static int readdir_r (DIR *dirp, struct dirent *ent, struct dirent **res)
672{ 732{
673 struct dirent *e; 733 struct dirent *e;
674 int errorno; 734 int errorno;
675 735
676 pthread_mutex_lock (&readdirlock); 736 LOCK (readdirlock);
677 737
678 e = readdir (dirp); 738 e = readdir (dirp);
679 errorno = errno; 739 errorno = errno;
680 740
681 if (e) 741 if (e)
684 strcpy (ent->d_name, e->d_name); 744 strcpy (ent->d_name, e->d_name);
685 } 745 }
686 else 746 else
687 *res = 0; 747 *res = 0;
688 748
689 pthread_mutex_unlock (&readdirlock); 749 UNLOCK (readdirlock);
690 750
691 errno = errorno; 751 errno = errorno;
692 return e ? 0 : -1; 752 return e ? 0 : -1;
693} 753}
694#endif 754#endif
695 755
696/* sendfile always needs emulation */ 756/* sendfile always needs emulation */
697static ssize_t sendfile_ (int ofd, int ifd, off_t offset, size_t count) 757static ssize_t sendfile_ (int ofd, int ifd, off_t offset, size_t count, worker *self)
698{ 758{
699 ssize_t res; 759 ssize_t res;
700 760
701 if (!count) 761 if (!count)
702 return 0; 762 return 0;
779 839
780 offset += cnt; 840 offset += cnt;
781 res += cnt; 841 res += cnt;
782 count -= cnt; 842 count -= cnt;
783 } 843 }
784
785 fBUF;
786 } 844 }
787 845
788 return res; 846 return res;
789} 847}
790 848
791/* read a full directory */ 849/* read a full directory */
792static int scandir_ (const char *path, void **namesp) 850static void scandir_ (aio_req req, worker *self)
793{ 851{
794 DIR *dirp; 852 DIR *dirp;
795 union 853 union
796 { 854 {
797 struct dirent d; 855 struct dirent d;
802 int memlen = 4096; 860 int memlen = 4096;
803 int memofs = 0; 861 int memofs = 0;
804 int res = 0; 862 int res = 0;
805 int errorno; 863 int errorno;
806 864
807 dirp = opendir (path); 865 LOCK (wrklock);
808 if (!dirp) 866 self->dirp = dirp = opendir (req->dataptr);
809 return -1;
810
811 u = malloc (sizeof (*u)); 867 self->dbuf = u = malloc (sizeof (*u));
868 UNLOCK (wrklock);
869
812 names = malloc (memlen); 870 req->data2ptr = names = malloc (memlen);
813 871
814 if (u && names) 872 if (dirp && u && names)
815 for (;;) 873 for (;;)
816 { 874 {
817 errno = 0; 875 errno = 0;
818 readdir_r (dirp, &u->d, &entp); 876 readdir_r (dirp, &u->d, &entp);
819 877
829 res++; 887 res++;
830 888
831 while (memofs + len > memlen) 889 while (memofs + len > memlen)
832 { 890 {
833 memlen *= 2; 891 memlen *= 2;
892 LOCK (wrklock);
834 names = realloc (names, memlen); 893 req->data2ptr = names = realloc (names, memlen);
894 UNLOCK (wrklock);
895
835 if (!names) 896 if (!names)
836 break; 897 break;
837 } 898 }
838 899
839 memcpy (names + memofs, name, len); 900 memcpy (names + memofs, name, len);
840 memofs += len; 901 memofs += len;
841 } 902 }
842 } 903 }
843 904
844 errorno = errno;
845 free (u);
846 closedir (dirp);
847
848 if (errorno) 905 if (errno)
849 {
850 free (names);
851 errno = errorno;
852 res = -1; 906 res = -1;
853 } 907
854 908 req->result = res;
855 *namesp = (void *)names;
856 return res;
857} 909}
858 910
859/*****************************************************************************/ 911/*****************************************************************************/
860 912
861static void *aio_proc (void *thr_arg) 913static void *aio_proc (void *thr_arg)
862{ 914{
863 aio_req req; 915 aio_req req;
864 int type; 916 int type;
917 worker *self = (worker *)thr_arg;
865 918
866 do 919 do
867 { 920 {
868 pthread_mutex_lock (&reqlock); 921 LOCK (reqlock);
869 922
870 for (;;) 923 for (;;)
871 { 924 {
872 req = reqq_shift (&req_queue); 925 self->req = req = reqq_shift (&req_queue);
873 926
874 if (req) 927 if (req)
875 break; 928 break;
876 929
877 pthread_cond_wait (&reqwait, &reqlock); 930 pthread_cond_wait (&reqwait, &reqlock);
878 } 931 }
879 932
880 pthread_mutex_unlock (&reqlock); 933 UNLOCK (reqlock);
881 934
882 errno = 0; /* strictly unnecessary */ 935 errno = 0; /* strictly unnecessary */
883 type = req->type; /* remember type for QUIT check */ 936 type = req->type; /* remember type for QUIT check */
884 937
885 if (!(req->flags & FLAG_CANCELLED)) 938 if (!(req->flags & FLAG_CANCELLED))
887 { 940 {
888 case REQ_READ: req->result = pread (req->fd, req->dataptr, req->length, req->offset); break; 941 case REQ_READ: req->result = pread (req->fd, req->dataptr, req->length, req->offset); break;
889 case REQ_WRITE: req->result = pwrite (req->fd, req->dataptr, req->length, req->offset); break; 942 case REQ_WRITE: req->result = pwrite (req->fd, req->dataptr, req->length, req->offset); break;
890 943
891 case REQ_READAHEAD: req->result = readahead (req->fd, req->offset, req->length); break; 944 case REQ_READAHEAD: req->result = readahead (req->fd, req->offset, req->length); break;
892 case REQ_SENDFILE: req->result = sendfile_ (req->fd, req->fd2, req->offset, req->length); break; 945 case REQ_SENDFILE: req->result = sendfile_ (req->fd, req->fd2, req->offset, req->length, self); break;
893 946
894 case REQ_STAT: req->result = stat (req->dataptr, req->statdata); break; 947 case REQ_STAT: req->result = stat (req->dataptr, req->statdata); break;
895 case REQ_LSTAT: req->result = lstat (req->dataptr, req->statdata); break; 948 case REQ_LSTAT: req->result = lstat (req->dataptr, req->statdata); break;
896 case REQ_FSTAT: req->result = fstat (req->fd , req->statdata); break; 949 case REQ_FSTAT: req->result = fstat (req->fd , req->statdata); break;
897 950
903 case REQ_LINK: req->result = link (req->data2ptr, req->dataptr); break; 956 case REQ_LINK: req->result = link (req->data2ptr, req->dataptr); break;
904 case REQ_SYMLINK: req->result = symlink (req->data2ptr, req->dataptr); break; 957 case REQ_SYMLINK: req->result = symlink (req->data2ptr, req->dataptr); break;
905 958
906 case REQ_FDATASYNC: req->result = fdatasync (req->fd); break; 959 case REQ_FDATASYNC: req->result = fdatasync (req->fd); break;
907 case REQ_FSYNC: req->result = fsync (req->fd); break; 960 case REQ_FSYNC: req->result = fsync (req->fd); break;
908 case REQ_READDIR: req->result = scandir_ (req->dataptr, &req->data2ptr); break; 961 case REQ_READDIR: scandir_ (req, self); break;
909 962
910 case REQ_BUSY: 963 case REQ_BUSY:
911 { 964 {
912 struct timeval tv; 965 struct timeval tv;
913 966
927 break; 980 break;
928 } 981 }
929 982
930 req->errorno = errno; 983 req->errorno = errno;
931 984
932 pthread_mutex_lock (&reslock); 985 LOCK (reslock);
933 986
934 if (!reqq_push (&res_queue, req)) 987 if (!reqq_push (&res_queue, req))
935 /* write a dummy byte to the pipe so fh becomes ready */ 988 /* write a dummy byte to the pipe so fh becomes ready */
936 write (respipe [1], &respipe, 1); 989 write (respipe [1], &respipe, 1);
937 990
938 pthread_mutex_unlock (&reslock); 991 self->req = 0;
992 worker_clear (self);
993
994 UNLOCK (reslock);
939 } 995 }
940 while (type != REQ_QUIT); 996 while (type != REQ_QUIT);
941 997
998 LOCK (wrklock);
999 worker_free (self);
1000 UNLOCK (wrklock);
1001
942 return 0; 1002 return 0;
943} 1003}
944 1004
945/*****************************************************************************/ 1005/*****************************************************************************/
946 1006
947static void atfork_prepare (void) 1007static void atfork_prepare (void)
948{ 1008{
949 pthread_mutex_lock (&reqlock); 1009 LOCK (wrklock);
950 pthread_mutex_lock (&reslock); 1010 LOCK (reqlock);
1011 LOCK (reslock);
951#if !HAVE_PREADWRITE 1012#if !HAVE_PREADWRITE
952 pthread_mutex_lock (&preadwritelock); 1013 LOCK (preadwritelock);
953#endif 1014#endif
954#if !HAVE_READDIR_R 1015#if !HAVE_READDIR_R
955 pthread_mutex_lock (&readdirlock); 1016 LOCK (readdirlock);
956#endif 1017#endif
957} 1018}
958 1019
959static void atfork_parent (void) 1020static void atfork_parent (void)
960{ 1021{
961#if !HAVE_READDIR_R 1022#if !HAVE_READDIR_R
962 pthread_mutex_unlock (&readdirlock); 1023 UNLOCK (readdirlock);
963#endif 1024#endif
964#if !HAVE_PREADWRITE 1025#if !HAVE_PREADWRITE
965 pthread_mutex_unlock (&preadwritelock); 1026 UNLOCK (preadwritelock);
966#endif 1027#endif
967 pthread_mutex_unlock (&reslock); 1028 UNLOCK (reslock);
968 pthread_mutex_unlock (&reqlock); 1029 UNLOCK (reqlock);
1030 UNLOCK (wrklock);
969} 1031}
970 1032
971static void atfork_child (void) 1033static void atfork_child (void)
972{ 1034{
973 aio_req prv; 1035 aio_req prv;
974
975 started = 0;
976 1036
977 while (prv = reqq_shift (&req_queue)) 1037 while (prv = reqq_shift (&req_queue))
978 req_free (prv); 1038 req_free (prv);
979 1039
980 while (prv = reqq_shift (&res_queue)) 1040 while (prv = reqq_shift (&res_queue))
981 req_free (prv); 1041 req_free (prv);
982 1042
1043 while (wrk_first.next != &wrk_first)
1044 {
1045 worker *wrk = wrk_first.next;
1046
1047 if (wrk->req)
1048 req_free (wrk->req);
1049
1050 worker_clear (wrk);
1051 worker_free (wrk);
1052 }
1053
1054 started = 0;
1055 nreqs = 0;
1056
983 close (respipe [0]); 1057 close (respipe [0]);
984 close (respipe [1]); 1058 close (respipe [1]);
985 create_pipe (); 1059 create_pipe ();
986 1060
987 atfork_parent (); 1061 atfork_parent ();
1031void 1105void
1032max_parallel (nthreads) 1106max_parallel (nthreads)
1033 int nthreads 1107 int nthreads
1034 PROTOTYPE: $ 1108 PROTOTYPE: $
1035 1109
1036int
1037max_outstanding (nreqs)
1038 int nreqs
1039 PROTOTYPE: $
1040 CODE:
1041 RETVAL = max_outstanding;
1042 max_outstanding = nreqs;
1043
1044void 1110void
1045aio_open (pathname,flags,mode,callback=&PL_sv_undef) 1111aio_open (pathname,flags,mode,callback=&PL_sv_undef)
1046 SV * pathname 1112 SV * pathname
1047 int flags 1113 int flags
1048 int mode 1114 int mode
1419 } 1485 }
1420 } 1486 }
1421} 1487}
1422 1488
1423void 1489void
1490cancel_subs (aio_req_ornot req)
1491 CODE:
1492 req_cancel_subs (req);
1493
1494void
1424result (aio_req grp, ...) 1495result (aio_req grp, ...)
1425 CODE: 1496 CODE:
1426{ 1497{
1427 int i; 1498 int i;
1428 AV *av = newAV (); 1499 AV *av = newAV ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines