ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.c
(Generate patch)

Comparing libev/ev.c (file contents):
Revision 1.33 by root, Thu Nov 1 11:11:22 2007 UTC vs.
Revision 1.36 by root, Thu Nov 1 13:11:11 2007 UTC

1/* 1/*
2 * libev event processing core, watcher management
3 *
2 * Copyright (c) 2007 Marc Alexander Lehmann <libev@schmorp.de> 4 * Copyright (c) 2007 Marc Alexander Lehmann <libev@schmorp.de>
3 * All rights reserved. 5 * All rights reserved.
4 * 6 *
5 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 8 * modification, are permitted provided that the following conditions are
323/*****************************************************************************/ 325/*****************************************************************************/
324 326
325typedef struct 327typedef struct
326{ 328{
327 struct ev_signal *head; 329 struct ev_signal *head;
328 sig_atomic_t gotsig; 330 sig_atomic_t volatile gotsig;
329} ANSIG; 331} ANSIG;
330 332
331static ANSIG *signals; 333static ANSIG *signals;
332static int signalmax; 334static int signalmax;
333 335
334static int sigpipe [2]; 336static int sigpipe [2];
335static sig_atomic_t gotsig; 337static sig_atomic_t volatile gotsig;
336static struct ev_io sigev; 338static struct ev_io sigev;
337 339
338static void 340static void
339signals_init (ANSIG *base, int count) 341signals_init (ANSIG *base, int count)
340{ 342{
353 signals [signum - 1].gotsig = 1; 355 signals [signum - 1].gotsig = 1;
354 356
355 if (!gotsig) 357 if (!gotsig)
356 { 358 {
357 gotsig = 1; 359 gotsig = 1;
358 write (sigpipe [1], &gotsig, 1); 360 write (sigpipe [1], &signum, 1);
359 } 361 }
360} 362}
361 363
362static void 364static void
363sigcb (struct ev_io *iow, int revents) 365sigcb (struct ev_io *iow, int revents)
364{ 366{
365 struct ev_signal *w; 367 struct ev_signal *w;
366 int sig; 368 int sig;
367 369
370 read (sigpipe [0], &revents, 1);
368 gotsig = 0; 371 gotsig = 0;
369 read (sigpipe [0], &revents, 1);
370 372
371 for (sig = signalmax; sig--; ) 373 for (sig = signalmax; sig--; )
372 if (signals [sig].gotsig) 374 if (signals [sig].gotsig)
373 { 375 {
374 signals [sig].gotsig = 0; 376 signals [sig].gotsig = 0;
489} 491}
490 492
491/*****************************************************************************/ 493/*****************************************************************************/
492 494
493void 495void
494ev_prefork (void) 496ev_fork_prepare (void)
495{ 497{
496 /* nop */ 498 /* nop */
497} 499}
498 500
499void 501void
500ev_postfork_parent (void) 502ev_fork_parent (void)
501{ 503{
502 /* nop */ 504 /* nop */
503} 505}
504 506
505void 507void
506ev_postfork_child (void) 508ev_fork_child (void)
507{ 509{
508#if EV_USE_EPOLL 510#if EV_USE_EPOLL
509 if (ev_method == EVMETHOD_EPOLL) 511 if (ev_method == EVMETHOD_EPOLL)
510 epoll_postfork_child (); 512 epoll_postfork_child ();
511#endif 513#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines