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.122 by root, Tue May 13 19:35:16 2008 UTC vs.
Revision 1.126 by root, Thu Sep 25 07:56:07 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
412 X_UNLOCK (reslock); 418 X_UNLOCK (reslock);
413 419
414 if (size) 420 if (size)
415 return; 421 return;
416 422
417 maybe_start_thread (); 423 etp_maybe_start_thread ();
418 424
419 FD_ZERO (&rfd); 425 FD_ZERO (&rfd);
420 FD_SET (respipe [0], &rfd); 426 FD_SET (respipe [0], &rfd);
421 427
422 PerlSock_select (respipe [0] + 1, &rfd, 0, 0, 0); 428 PerlSock_select (respipe [0] + 1, &rfd, 0, 0, 0);
423 } 429 }
424} 430}
425 431
426static int poll_cb (void) 432static int poll_cb (void)
427{ 433{
428 int res; 434 for (;;)
429
430 do
431 { 435 {
432 res = eio_poll (); 436 int res = eio_poll ();
433 437
434 if (res > 0) 438 if (res > 0)
435 croak (0); 439 croak (0);
440
441 if (!max_outstanding || max_outstanding > eio_nreqs ())
442 return res;
443
444 poll_wait ();
436 } 445 }
437 while (max_outstanding && max_outstanding <= eio_nreqs ());
438
439 return res;
440} 446}
441 447
442static void atfork_child (void) 448static void atfork_child (void)
443{ 449{
444 create_respipe (); 450 create_respipe ();
458 \ 464 \
459 req->callback = newSVsv (callback); \ 465 req->callback = newSVsv (callback); \
460 req->pri = req_pri 466 req->pri = req_pri
461 467
462#define REQ_SEND \ 468#define REQ_SEND \
469 PUTBACK; \
463 req_submit (req); \ 470 req_submit (req); \
471 SPAGAIN; \
464 \ 472 \
465 if (GIMME_V != G_VOID) \ 473 if (GIMME_V != G_VOID) \
466 XPUSHs (req_sv (req, AIO_REQ_KLASS)); 474 XPUSHs (req_sv (req, AIO_REQ_KLASS));
467 475
468MODULE = IO::AIO PACKAGE = IO::AIO 476MODULE = IO::AIO PACKAGE = IO::AIO

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines