ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Async-Interrupt/schmorp.h
(Generate patch)

Comparing Async-Interrupt/schmorp.h (file contents):
Revision 1.4 by root, Fri Jul 17 21:04:45 2009 UTC vs.
Revision 1.5 by root, Sat Jul 18 05:14:19 2009 UTC

209/* taken almost verbatim from libev's ev_win32.c */ 209/* taken almost verbatim from libev's ev_win32.c */
210/* oh, the humanity! */ 210/* oh, the humanity! */
211static int 211static int
212s_pipe (int filedes [2]) 212s_pipe (int filedes [2])
213{ 213{
214 dTHX;
215
214 struct sockaddr_in addr = { 0 }; 216 struct sockaddr_in addr = { 0 };
215 int addr_size = sizeof (addr); 217 int addr_size = sizeof (addr);
216 struct sockaddr_in adr2; 218 struct sockaddr_in adr2;
217 int adr2_size = sizeof (adr2); 219 int adr2_size = sizeof (adr2);
218 SOCKET listener; 220 SOCKET listener;
359 return -1; 361 return -1;
360 362
361 if (s_fd_prepare (ep.fd [0]) 363 if (s_fd_prepare (ep.fd [0])
362 || s_fd_prepare (ep.fd [1])) 364 || s_fd_prepare (ep.fd [1]))
363 { 365 {
366 dTHX;
367
364 close (ep.fd [0]); 368 close (ep.fd [0]);
365 close (ep.fd [1]); 369 close (ep.fd [1]);
366 return -1; 370 return -1;
367 } 371 }
368 372
374} 378}
375 379
376static void 380static void
377s_epipe_destroy (s_epipe *epp) 381s_epipe_destroy (s_epipe *epp)
378{ 382{
383 dTHX;
384
379 close (epp->fd [0]); 385 close (epp->fd [0]);
380 386
381 if (epp->fd [1] != epp->fd [0]) 387 if (epp->fd [1] != epp->fd [0])
382 close (epp->fd [1]); 388 close (epp->fd [1]);
383 389
406} 412}
407 413
408static void 414static void
409s_epipe_drain (s_epipe *epp) 415s_epipe_drain (s_epipe *epp)
410{ 416{
417 dTHX;
411 char buf [9]; 418 char buf [9];
412 419
413#ifdef _WIN32 420#ifdef _WIN32
414 recv (epp->fd [0], buf, sizeof (buf), 0); 421 recv (epp->fd [0], buf, sizeof (buf), 0);
415#else 422#else
419 426
420/* like new, but dups over old */ 427/* like new, but dups over old */
421static int 428static int
422s_epipe_renew (s_epipe *epp) 429s_epipe_renew (s_epipe *epp)
423{ 430{
431 dTHX;
424 s_epipe epn; 432 s_epipe epn;
425 433
426 if (epp->fd [1] != epp->fd [0]) 434 if (epp->fd [1] != epp->fd [0])
427 close (epp->fd [1]); 435 close (epp->fd [1]);
428 436
448#define s_epipe_fd(epp) ((epp)->fd [0]) 456#define s_epipe_fd(epp) ((epp)->fd [0])
449 457
450static int 458static int
451s_epipe_wait (s_epipe *epp) 459s_epipe_wait (s_epipe *epp)
452{ 460{
461 dTHX;
453#ifdef _WIN32 462#ifdef _WIN32
454 fd_set rfd; 463 fd_set rfd;
455 int fd = s_epipe_fd (epp); 464 int fd = s_epipe_fd (epp);
456 465
457 FD_ZERO (&rfd); 466 FD_ZERO (&rfd);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines