… | |
… | |
541 | |
541 | |
542 | if (!gotsig) |
542 | if (!gotsig) |
543 | { |
543 | { |
544 | int old_errno = errno; |
544 | int old_errno = errno; |
545 | gotsig = 1; |
545 | gotsig = 1; |
|
|
546 | #ifdef WIN32 |
|
|
547 | send (sigpipe [1], &signum, 1, MSG_DONTWAIT); |
|
|
548 | #else |
546 | write (sigpipe [1], &signum, 1); |
549 | write (sigpipe [1], &signum, 1); |
|
|
550 | #endif |
547 | errno = old_errno; |
551 | errno = old_errno; |
548 | } |
552 | } |
549 | } |
553 | } |
550 | |
554 | |
551 | static void |
555 | static void |
552 | sigcb (EV_P_ struct ev_io *iow, int revents) |
556 | sigcb (EV_P_ struct ev_io *iow, int revents) |
553 | { |
557 | { |
554 | WL w; |
558 | WL w; |
555 | int signum; |
559 | int signum; |
556 | |
560 | |
|
|
561 | #ifdef WIN32 |
|
|
562 | recv (sigpipe [0], &revents, 1, MSG_DONTWAIT); |
|
|
563 | #else |
557 | read (sigpipe [0], &revents, 1); |
564 | read (sigpipe [0], &revents, 1); |
|
|
565 | #endif |
558 | gotsig = 0; |
566 | gotsig = 0; |
559 | |
567 | |
560 | for (signum = signalmax; signum--; ) |
568 | for (signum = signalmax; signum--; ) |
561 | if (signals [signum].gotsig) |
569 | if (signals [signum].gotsig) |
562 | { |
570 | { |
… | |
… | |
888 | if (method) |
896 | if (method) |
889 | postfork = 1; |
897 | postfork = 1; |
890 | } |
898 | } |
891 | |
899 | |
892 | /*****************************************************************************/ |
900 | /*****************************************************************************/ |
|
|
901 | |
|
|
902 | static int |
|
|
903 | any_pending (EV_P) |
|
|
904 | { |
|
|
905 | int pri; |
|
|
906 | |
|
|
907 | for (pri = NUMPRI; pri--; ) |
|
|
908 | if (pendingcnt [pri]) |
|
|
909 | return 1; |
|
|
910 | |
|
|
911 | return 0; |
|
|
912 | } |
893 | |
913 | |
894 | static void |
914 | static void |
895 | call_pending (EV_P) |
915 | call_pending (EV_P) |
896 | { |
916 | { |
897 | int pri; |
917 | int pri; |
… | |
… | |
1081 | /* update fd-related kernel structures */ |
1101 | /* update fd-related kernel structures */ |
1082 | fd_reify (EV_A); |
1102 | fd_reify (EV_A); |
1083 | |
1103 | |
1084 | /* calculate blocking time */ |
1104 | /* calculate blocking time */ |
1085 | |
1105 | |
1086 | /* we only need this for !monotonic clockor timers, but as we basically |
1106 | /* we only need this for !monotonic clock or timers, but as we basically |
1087 | always have timers, we just calculate it always */ |
1107 | always have timers, we just calculate it always */ |
1088 | #if EV_USE_MONOTONIC |
1108 | #if EV_USE_MONOTONIC |
1089 | if (expect_true (have_monotonic)) |
1109 | if (expect_true (have_monotonic)) |
1090 | time_update_monotonic (EV_A); |
1110 | time_update_monotonic (EV_A); |
1091 | else |
1111 | else |
… | |
… | |
1124 | /* queue pending timers and reschedule them */ |
1144 | /* queue pending timers and reschedule them */ |
1125 | timers_reify (EV_A); /* relative timers called last */ |
1145 | timers_reify (EV_A); /* relative timers called last */ |
1126 | periodics_reify (EV_A); /* absolute timers called first */ |
1146 | periodics_reify (EV_A); /* absolute timers called first */ |
1127 | |
1147 | |
1128 | /* queue idle watchers unless io or timers are pending */ |
1148 | /* queue idle watchers unless io or timers are pending */ |
1129 | if (!pendingcnt) |
1149 | if (idlecnt && !any_pending (EV_A)) |
1130 | queue_events (EV_A_ (W *)idles, idlecnt, EV_IDLE); |
1150 | queue_events (EV_A_ (W *)idles, idlecnt, EV_IDLE); |
1131 | |
1151 | |
1132 | /* queue check watchers, to be executed first */ |
1152 | /* queue check watchers, to be executed first */ |
1133 | if (checkcnt) |
1153 | if (checkcnt) |
1134 | queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK); |
1154 | queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK); |