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.62 by root, Mon Oct 23 22:45:18 2006 UTC vs.
Revision 1.70 by root, Tue Oct 24 15:15:56 2006 UTC

1/* solaris */
2#define _POSIX_PTHREAD_SEMANTICS 1
3
4#if __linux
5# define _GNU_SOURCE
6#endif
7
1#define _REENTRANT 1 8#define _REENTRANT 1
9
2#include <errno.h> 10#include <errno.h>
3 11
4#include "EXTERN.h" 12#include "EXTERN.h"
5#include "perl.h" 13#include "perl.h"
6#include "XSUB.h" 14#include "XSUB.h"
41# define NAME_MAX 4096 49# define NAME_MAX 4096
42#endif 50#endif
43 51
44#if __ia64 52#if __ia64
45# define STACKSIZE 65536 53# define STACKSIZE 65536
54#elif __i386 || __x86_64 /* 16k is unreasonably high :( */
55# define STACKSIZE PTHREAD_STACK_MIN
46#else 56#else
47# define STACKSIZE 8192 57# define STACKSIZE 16384
48#endif 58#endif
59
60/* buffer size for various temporary buffers */
61#define AIO_BUFSIZE 65536
62
63#define dBUF \
64 char *aio_buf = malloc (AIO_BUFSIZE); \
65 if (!aio_buf) \
66 return -1;
67
68#define fBUF free (aio_buf)
49 69
50enum { 70enum {
51 REQ_QUIT, 71 REQ_QUIT,
52 REQ_OPEN, REQ_CLOSE, 72 REQ_OPEN, REQ_CLOSE,
53 REQ_READ, REQ_WRITE, REQ_READAHEAD, 73 REQ_READ, REQ_WRITE, REQ_READAHEAD,
56 REQ_FSYNC, REQ_FDATASYNC, 76 REQ_FSYNC, REQ_FDATASYNC,
57 REQ_UNLINK, REQ_RMDIR, REQ_RENAME, 77 REQ_UNLINK, REQ_RMDIR, REQ_RENAME,
58 REQ_READDIR, 78 REQ_READDIR,
59 REQ_LINK, REQ_SYMLINK, 79 REQ_LINK, REQ_SYMLINK,
60 REQ_GROUP, REQ_NOP, 80 REQ_GROUP, REQ_NOP,
61 REQ_SLEEP, 81 REQ_BUSY,
62}; 82};
63 83
64#define AIO_REQ_KLASS "IO::AIO::REQ" 84#define AIO_REQ_KLASS "IO::AIO::REQ"
65#define AIO_GRP_KLASS "IO::AIO::GRP" 85#define AIO_GRP_KLASS "IO::AIO::GRP"
66 86
100 PRI_MIN = -4, 120 PRI_MIN = -4,
101 PRI_MAX = 4, 121 PRI_MAX = 4,
102 122
103 DEFAULT_PRI = 0, 123 DEFAULT_PRI = 0,
104 PRI_BIAS = -PRI_MIN, 124 PRI_BIAS = -PRI_MIN,
125 NUM_PRI = PRI_MAX + PRI_BIAS + 1,
105}; 126};
106 127
107static int next_pri = DEFAULT_PRI + PRI_BIAS; 128static int next_pri = DEFAULT_PRI + PRI_BIAS;
108 129
109static int started, wanted; 130static int started, wanted;
110static volatile int nreqs; 131static volatile int nreqs;
111static int max_outstanding = 1<<30; 132static int max_outstanding = 1<<30;
112static int respipe [2]; 133static int respipe [2];
113 134
135#if __linux && defined (PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP)
136# define AIO_MUTEX_INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
137#else
138# define AIO_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
139#endif
140
114static pthread_mutex_t reslock = PTHREAD_MUTEX_INITIALIZER; 141static pthread_mutex_t reslock = AIO_MUTEX_INIT;
115static pthread_mutex_t reqlock = PTHREAD_MUTEX_INITIALIZER; 142static pthread_mutex_t reqlock = AIO_MUTEX_INIT;
116static pthread_cond_t reqwait = PTHREAD_COND_INITIALIZER; 143static pthread_cond_t reqwait = PTHREAD_COND_INITIALIZER;
117 144
118static volatile aio_req reqs, reqe; /* queue start, queue end */ 145/*
119static volatile aio_req ress, rese; /* queue start, queue end */ 146 * a somewhat faster data structure might be nice, but
147 * with 8 priorities this actually needs <20 insns
148 * per shift, the most expensive operation.
149 */
150typedef struct {
151 aio_req qs[NUM_PRI], qe[NUM_PRI]; /* qstart, qend */
152 int size;
153} reqq;
154
155static reqq req_queue;
156static reqq res_queue;
157
158int reqq_push (reqq *q, aio_req req)
159{
160 int pri = req->pri;
161 req->next = 0;
162
163 if (q->qe[pri])
164 {
165 q->qe[pri]->next = req;
166 q->qe[pri] = req;
167 }
168 else
169 q->qe[pri] = q->qs[pri] = req;
170
171 return q->size++;
172}
173
174aio_req reqq_shift (reqq *q)
175{
176 int pri;
177
178 if (!q->size)
179 return 0;
180
181 --q->size;
182
183 for (pri = NUM_PRI; pri--; )
184 {
185 aio_req req = q->qs[pri];
186
187 if (req)
188 {
189 if (!(q->qs[pri] = req->next))
190 q->qe[pri] = 0;
191
192 return req;
193 }
194 }
195
196 abort ();
197}
120 198
121static void req_invoke (aio_req req); 199static void req_invoke (aio_req req);
122static void req_free (aio_req req); 200static void req_free (aio_req req);
123 201
124/* must be called at most once */ 202/* must be called at most once */
158 ENTER; 236 ENTER;
159 SAVETMPS; 237 SAVETMPS;
160 PUSHMARK (SP); 238 PUSHMARK (SP);
161 XPUSHs (req_sv (grp, AIO_GRP_KLASS)); 239 XPUSHs (req_sv (grp, AIO_GRP_KLASS));
162 PUTBACK; 240 PUTBACK;
163 call_sv (grp->fh2, G_VOID | G_EVAL); 241 call_sv (grp->fh2, G_VOID | G_EVAL | G_KEEPERR);
164 SPAGAIN; 242 SPAGAIN;
165 FREETMPS; 243 FREETMPS;
166 LEAVE; 244 LEAVE;
167 } 245 }
168 246
195{ 273{
196 fd_set rfd; 274 fd_set rfd;
197 275
198 while (nreqs) 276 while (nreqs)
199 { 277 {
200 aio_req req; 278 int size;
279#if !(__i386 || __x86_64) /* safe without sempahore on this archs */
201 pthread_mutex_lock (&reslock); 280 pthread_mutex_lock (&reslock);
202 req = ress; 281#endif
282 size = res_queue.size;
283#if !(__i386 || __x86_64) /* safe without sempahore on this archs */
203 pthread_mutex_unlock (&reslock); 284 pthread_mutex_unlock (&reslock);
285#endif
204 286
205 if (req) 287 if (size)
206 return; 288 return;
207 289
208 FD_ZERO(&rfd); 290 FD_ZERO(&rfd);
209 FD_SET(respipe [0], &rfd); 291 FD_SET(respipe [0], &rfd);
210 292
213} 295}
214 296
215static void req_invoke (aio_req req) 297static void req_invoke (aio_req req)
216{ 298{
217 dSP; 299 dSP;
218 int errorno = errno;
219 300
220 if (req->flags & FLAG_CANCELLED || !SvOK (req->callback)) 301 if (!(req->flags & FLAG_CANCELLED) && SvOK (req->callback))
221 return; 302 {
222
223 errno = req->errorno; 303 errno = req->errorno;
224 304
225 ENTER; 305 ENTER;
226 SAVETMPS; 306 SAVETMPS;
227 PUSHMARK (SP); 307 PUSHMARK (SP);
228 EXTEND (SP, 1); 308 EXTEND (SP, 1);
229 309
230 switch (req->type) 310 switch (req->type)
231 {
232 case REQ_READDIR:
233 { 311 {
234 SV *rv = &PL_sv_undef; 312 case REQ_READDIR:
235
236 if (req->result >= 0)
237 { 313 {
238 char *buf = req->data2ptr; 314 SV *rv = &PL_sv_undef;
239 AV *av = newAV ();
240 315
241 while (req->result) 316 if (req->result >= 0)
242 { 317 {
318 char *buf = req->data2ptr;
319 AV *av = newAV ();
320
321 while (req->result)
322 {
243 SV *sv = newSVpv (buf, 0); 323 SV *sv = newSVpv (buf, 0);
244 324
245 av_push (av, sv); 325 av_push (av, sv);
246 buf += SvCUR (sv) + 1; 326 buf += SvCUR (sv) + 1;
247 req->result--; 327 req->result--;
328 }
329
330 rv = sv_2mortal (newRV_noinc ((SV *)av));
248 } 331 }
249 332
250 rv = sv_2mortal (newRV_noinc ((SV *)av)); 333 PUSHs (rv);
251 } 334 }
335 break;
252 336
253 PUSHs (rv); 337 case REQ_OPEN:
338 {
339 /* convert fd to fh */
340 SV *fh;
341
342 PUSHs (sv_2mortal (newSViv (req->result)));
343 PUTBACK;
344 call_pv ("IO::AIO::_fd2fh", G_SCALAR | G_EVAL);
345 SPAGAIN;
346
347 fh = SvREFCNT_inc (POPs);
348
349 PUSHMARK (SP);
350 XPUSHs (sv_2mortal (fh));
351 }
352 break;
353
354 case REQ_GROUP:
355 req->fd = 2; /* mark group as finished */
356
357 if (req->data)
358 {
359 int i;
360 AV *av = (AV *)req->data;
361
362 EXTEND (SP, AvFILL (av) + 1);
363 for (i = 0; i <= AvFILL (av); ++i)
364 PUSHs (*av_fetch (av, i, 0));
365 }
366 break;
367
368 case REQ_NOP:
369 case REQ_BUSY:
370 break;
371
372 default:
373 PUSHs (sv_2mortal (newSViv (req->result)));
374 break;
254 } 375 }
255 break;
256 376
257 case REQ_OPEN:
258 {
259 /* convert fd to fh */
260 SV *fh;
261 377
262 PUSHs (sv_2mortal (newSViv (req->result)));
263 PUTBACK; 378 PUTBACK;
264 call_pv ("IO::AIO::_fd2fh", G_SCALAR | G_EVAL);
265 SPAGAIN;
266
267 fh = SvREFCNT_inc (POPs);
268
269 PUSHMARK (SP);
270 XPUSHs (sv_2mortal (fh));
271 }
272 break;
273
274 case REQ_GROUP:
275 req->fd = 2; /* mark group as finished */
276
277 if (req->data)
278 {
279 int i;
280 AV *av = (AV *)req->data;
281
282 EXTEND (SP, AvFILL (av) + 1);
283 for (i = 0; i <= AvFILL (av); ++i)
284 PUSHs (*av_fetch (av, i, 0));
285 }
286 break;
287
288 case REQ_NOP:
289 case REQ_SLEEP:
290 break;
291
292 default:
293 PUSHs (sv_2mortal (newSViv (req->result)));
294 break;
295 }
296
297
298 PUTBACK;
299 call_sv (req->callback, G_VOID | G_EVAL); 379 call_sv (req->callback, G_VOID | G_EVAL);
300 SPAGAIN; 380 SPAGAIN;
301 381
302 FREETMPS; 382 FREETMPS;
303 LEAVE; 383 LEAVE;
304
305 errno = errorno;
306
307 if (SvTRUE (ERRSV))
308 { 384 }
309 req_free (req);
310 croak (0);
311 }
312}
313 385
314static void req_free (aio_req req)
315{
316 if (req->grp) 386 if (req->grp)
317 { 387 {
318 aio_req grp = req->grp; 388 aio_req grp = req->grp;
319 389
320 /* unlink request */ 390 /* unlink request */
325 grp->grp_first = req->grp_next; 395 grp->grp_first = req->grp_next;
326 396
327 aio_grp_dec (grp); 397 aio_grp_dec (grp);
328 } 398 }
329 399
400 if (SvTRUE (ERRSV))
401 {
402 req_free (req);
403 croak (0);
404 }
405}
406
407static void req_free (aio_req req)
408{
330 if (req->self) 409 if (req->self)
331 { 410 {
332 sv_unmagic (req->self, PERL_MAGIC_ext); 411 sv_unmagic (req->self, PERL_MAGIC_ext);
333 SvREFCNT_dec (req->self); 412 SvREFCNT_dec (req->self);
334 } 413 }
366 aio_req req; 445 aio_req req;
367 446
368 for (;;) 447 for (;;)
369 { 448 {
370 pthread_mutex_lock (&reslock); 449 pthread_mutex_lock (&reslock);
371 req = ress; 450 req = reqq_shift (&res_queue);
372 451
373 if (req) 452 if (req)
374 { 453 {
375 ress = req->next;
376
377 if (!ress) 454 if (!res_queue.size)
378 { 455 {
379 /* read any signals sent by the worker threads */ 456 /* read any signals sent by the worker threads */
380 char buf [32]; 457 char buf [32];
381 while (read (respipe [0], buf, 32) == 32) 458 while (read (respipe [0], buf, 32) == 32)
382 ; 459 ;
383
384 rese = 0;
385 } 460 }
386 } 461 }
387 462
388 pthread_mutex_unlock (&reslock); 463 pthread_mutex_unlock (&reslock);
389 464
452 start_thread (); 527 start_thread ();
453 528
454 ++nreqs; 529 ++nreqs;
455 530
456 pthread_mutex_lock (&reqlock); 531 pthread_mutex_lock (&reqlock);
457 532 reqq_push (&req_queue, req);
458 req->next = 0;
459
460 if (reqe)
461 {
462 reqe->next = req;
463 reqe = req;
464 }
465 else
466 reqe = reqs = req;
467
468 pthread_cond_signal (&reqwait); 533 pthread_cond_signal (&reqwait);
469 pthread_mutex_unlock (&reqlock); 534 pthread_mutex_unlock (&reqlock);
470 535
471 if (nreqs > max_outstanding) 536 if (nreqs > max_outstanding)
472 for (;;) 537 for (;;)
481} 546}
482 547
483static void end_thread (void) 548static void end_thread (void)
484{ 549{
485 aio_req req; 550 aio_req req;
551
486 Newz (0, req, 1, aio_cb); 552 Newz (0, req, 1, aio_cb);
553
487 req->type = REQ_QUIT; 554 req->type = REQ_QUIT;
555 req->pri = PRI_MAX + PRI_BIAS;
488 556
489 req_send (req); 557 req_send (req);
490} 558}
491 559
492static void min_parallel (int nthreads) 560static void min_parallel (int nthreads)
579#if !HAVE_READAHEAD 647#if !HAVE_READAHEAD
580# define readahead aio_readahead 648# define readahead aio_readahead
581 649
582static ssize_t readahead (int fd, off_t offset, size_t count) 650static ssize_t readahead (int fd, off_t offset, size_t count)
583{ 651{
584 char readahead_buf[4096]; 652 dBUF;
585 653
586 while (count > 0) 654 while (count > 0)
587 { 655 {
588 size_t len = count < sizeof (readahead_buf) ? count : sizeof (readahead_buf); 656 size_t len = count < AIO_BUFSIZE ? count : AIO_BUFSIZE;
589 657
590 pread (fd, readahead_buf, len, offset); 658 pread (fd, aio_buf, len, offset);
591 offset += len; 659 offset += len;
592 count -= len; 660 count -= len;
593 } 661 }
662
663 fBUF;
594 664
595 errno = 0; 665 errno = 0;
596} 666}
597#endif 667#endif
598 668
684#endif 754#endif
685 ) 755 )
686 ) 756 )
687 { 757 {
688 /* emulate sendfile. this is a major pain in the ass */ 758 /* emulate sendfile. this is a major pain in the ass */
689 char buf[4096]; 759 dBUF;
760
690 res = 0; 761 res = 0;
691 762
692 while (count) 763 while (count)
693 { 764 {
694 ssize_t cnt; 765 ssize_t cnt;
695 766
696 cnt = pread (ifd, buf, count > 4096 ? 4096 : count, offset); 767 cnt = pread (ifd, aio_buf, count > AIO_BUFSIZE ? AIO_BUFSIZE : count, offset);
697 768
698 if (cnt <= 0) 769 if (cnt <= 0)
699 { 770 {
700 if (cnt && !res) res = -1; 771 if (cnt && !res) res = -1;
701 break; 772 break;
702 } 773 }
703 774
704 cnt = write (ofd, buf, cnt); 775 cnt = write (ofd, aio_buf, cnt);
705 776
706 if (cnt <= 0) 777 if (cnt <= 0)
707 { 778 {
708 if (cnt && !res) res = -1; 779 if (cnt && !res) res = -1;
709 break; 780 break;
711 782
712 offset += cnt; 783 offset += cnt;
713 res += cnt; 784 res += cnt;
714 count -= cnt; 785 count -= cnt;
715 } 786 }
787
788 fBUF;
716 } 789 }
717 790
718 return res; 791 return res;
719} 792}
720 793
721/* read a full directory */ 794/* read a full directory */
722static int scandir_ (const char *path, void **namesp) 795static int scandir_ (const char *path, void **namesp)
723{ 796{
724 DIR *dirp = opendir (path); 797 DIR *dirp;
725 union 798 union
726 { 799 {
727 struct dirent d; 800 struct dirent d;
728 char b [offsetof (struct dirent, d_name) + NAME_MAX + 1]; 801 char b [offsetof (struct dirent, d_name) + NAME_MAX + 1];
729 } u; 802 } *u;
730 struct dirent *entp; 803 struct dirent *entp;
731 char *name, *names; 804 char *name, *names;
732 int memlen = 4096; 805 int memlen = 4096;
733 int memofs = 0; 806 int memofs = 0;
734 int res = 0; 807 int res = 0;
735 int errorno; 808 int errorno;
736 809
810 dirp = opendir (path);
737 if (!dirp) 811 if (!dirp)
738 return -1; 812 return -1;
739 813
814 u = malloc (sizeof (*u));
740 names = malloc (memlen); 815 names = malloc (memlen);
741 816
817 if (u && names)
742 for (;;) 818 for (;;)
743 { 819 {
820 errno = 0;
744 errno = 0, readdir_r (dirp, &u.d, &entp); 821 readdir_r (dirp, &u->d, &entp);
745 822
746 if (!entp) 823 if (!entp)
747 break; 824 break;
748 825
749 name = entp->d_name; 826 name = entp->d_name;
750 827
751 if (name [0] != '.' || (name [1] && (name [1] != '.' || name [2]))) 828 if (name [0] != '.' || (name [1] && (name [1] != '.' || name [2])))
752 { 829 {
753 int len = strlen (name) + 1; 830 int len = strlen (name) + 1;
754 831
755 res++; 832 res++;
756 833
757 while (memofs + len > memlen) 834 while (memofs + len > memlen)
758 { 835 {
759 memlen *= 2; 836 memlen *= 2;
760 names = realloc (names, memlen); 837 names = realloc (names, memlen);
761 if (!names) 838 if (!names)
762 break; 839 break;
763 } 840 }
764 841
765 memcpy (names + memofs, name, len); 842 memcpy (names + memofs, name, len);
766 memofs += len; 843 memofs += len;
767 } 844 }
768 } 845 }
769 846
770 errorno = errno; 847 errorno = errno;
848 free (u);
771 closedir (dirp); 849 closedir (dirp);
772 850
773 if (errorno) 851 if (errorno)
774 { 852 {
775 free (names); 853 free (names);
792 { 870 {
793 pthread_mutex_lock (&reqlock); 871 pthread_mutex_lock (&reqlock);
794 872
795 for (;;) 873 for (;;)
796 { 874 {
797 req = reqs; 875 req = reqq_shift (&req_queue);
798
799 if (reqs)
800 {
801 reqs = reqs->next;
802 if (!reqs) reqe = 0;
803 }
804 876
805 if (req) 877 if (req)
806 break; 878 break;
807 879
808 pthread_cond_wait (&reqwait, &reqlock); 880 pthread_cond_wait (&reqwait, &reqlock);
836 908
837 case REQ_FDATASYNC: req->result = fdatasync (req->fd); break; 909 case REQ_FDATASYNC: req->result = fdatasync (req->fd); break;
838 case REQ_FSYNC: req->result = fsync (req->fd); break; 910 case REQ_FSYNC: req->result = fsync (req->fd); break;
839 case REQ_READDIR: req->result = scandir_ (req->dataptr, &req->data2ptr); break; 911 case REQ_READDIR: req->result = scandir_ (req->dataptr, &req->data2ptr); break;
840 912
841 case REQ_SLEEP: 913 case REQ_BUSY:
842 { 914 {
843 struct timeval tv; 915 struct timeval tv;
844 916
845 tv.tv_sec = req->fd; 917 tv.tv_sec = req->fd;
846 tv.tv_usec = req->fd2; 918 tv.tv_usec = req->fd2;
860 932
861 req->errorno = errno; 933 req->errorno = errno;
862 934
863 pthread_mutex_lock (&reslock); 935 pthread_mutex_lock (&reslock);
864 936
865 req->next = 0; 937 if (!reqq_push (&res_queue, req))
866
867 if (rese)
868 {
869 rese->next = req;
870 rese = req;
871 }
872 else
873 {
874 rese = ress = req;
875
876 /* write a dummy byte to the pipe so fh becomes ready */ 938 /* write a dummy byte to the pipe so fh becomes ready */
877 write (respipe [1], &respipe, 1); 939 write (respipe [1], &respipe, 1);
878 }
879 940
880 pthread_mutex_unlock (&reslock); 941 pthread_mutex_unlock (&reslock);
881 } 942 }
882 while (type != REQ_QUIT); 943 while (type != REQ_QUIT);
883 944
914{ 975{
915 aio_req prv; 976 aio_req prv;
916 977
917 started = 0; 978 started = 0;
918 979
919 while (reqs) 980 while (prv = reqq_shift (&req_queue))
920 {
921 prv = reqs;
922 reqs = prv->next;
923 req_free (prv); 981 req_free (prv);
924 }
925 982
926 reqs = reqe = 0; 983 while (prv = reqq_shift (&res_queue))
927
928 while (ress)
929 {
930 prv = ress;
931 ress = prv->next;
932 req_free (prv); 984 req_free (prv);
933 } 985
934
935 ress = rese = 0;
936
937 close (respipe [0]); 986 close (respipe [0]);
938 close (respipe [1]); 987 close (respipe [1]);
939 create_pipe (); 988 create_pipe ();
940 989
941 atfork_parent (); 990 atfork_parent ();
1216 1265
1217 REQ_SEND; 1266 REQ_SEND;
1218} 1267}
1219 1268
1220void 1269void
1221aio_sleep (delay,callback=&PL_sv_undef) 1270aio_busy (delay,callback=&PL_sv_undef)
1222 double delay 1271 double delay
1223 SV * callback 1272 SV * callback
1224 PPCODE: 1273 PPCODE:
1225{ 1274{
1226 dREQ; 1275 dREQ;
1227 1276
1228 req->type = REQ_SLEEP; 1277 req->type = REQ_BUSY;
1229 req->fd = delay < 0. ? 0 : delay; 1278 req->fd = delay < 0. ? 0 : delay;
1230 req->fd2 = delay < 0. ? 0 : 1000. * (delay - req->fd); 1279 req->fd2 = delay < 0. ? 0 : 1000. * (delay - req->fd);
1231 1280
1232 REQ_SEND; 1281 REQ_SEND;
1233} 1282}
1256 req->type = REQ_NOP; 1305 req->type = REQ_NOP;
1257 1306
1258 REQ_SEND; 1307 REQ_SEND;
1259} 1308}
1260 1309
1261#if 0
1262
1263void 1310void
1264aio_pri (int pri = DEFAULT_PRI) 1311aioreq_pri (int pri = DEFAULT_PRI)
1265 CODE: 1312 CODE:
1266 if (pri < PRI_MIN) pri = PRI_MIN; 1313 if (pri < PRI_MIN) pri = PRI_MIN;
1267 if (pri > PRI_MAX) pri = PRI_MAX; 1314 if (pri > PRI_MAX) pri = PRI_MAX;
1268 next_pri = pri + PRI_BIAS; 1315 next_pri = pri + PRI_BIAS;
1269 1316
1270#endif 1317void
1318aioreq_nice (int nice = 0)
1319 CODE:
1320 nice = next_pri - nice;
1321 if (nice < PRI_MIN) nice = PRI_MIN;
1322 if (nice > PRI_MAX) nice = PRI_MAX;
1323 next_pri = nice + PRI_BIAS;
1271 1324
1272void 1325void
1273flush () 1326flush ()
1274 PROTOTYPE: 1327 PROTOTYPE:
1275 CODE: 1328 CODE:
1324 1377
1325MODULE = IO::AIO PACKAGE = IO::AIO::REQ 1378MODULE = IO::AIO PACKAGE = IO::AIO::REQ
1326 1379
1327void 1380void
1328cancel (aio_req_ornot req) 1381cancel (aio_req_ornot req)
1329 PROTOTYPE:
1330 CODE: 1382 CODE:
1331 req_cancel (req); 1383 req_cancel (req);
1332 1384
1333void 1385void
1334cb (aio_req_ornot req, SV *callback=&PL_sv_undef) 1386cb (aio_req_ornot req, SV *callback=&PL_sv_undef)
1384 SvREFCNT_dec (grp->data); 1436 SvREFCNT_dec (grp->data);
1385 grp->data = (SV *)av; 1437 grp->data = (SV *)av;
1386} 1438}
1387 1439
1388void 1440void
1389feed_limit (aio_req grp, int limit) 1441limit (aio_req grp, int limit)
1390 CODE: 1442 CODE:
1391 grp->fd2 = limit; 1443 grp->fd2 = limit;
1392 aio_grp_feed (grp); 1444 aio_grp_feed (grp);
1393 1445
1394void 1446void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines