… | |
… | |
964 | memset ((void *)(base), 0, sizeof (*(base)) * (count)) |
964 | memset ((void *)(base), 0, sizeof (*(base)) * (count)) |
965 | |
965 | |
966 | #define array_needsize(type,base,cur,cnt,init) \ |
966 | #define array_needsize(type,base,cur,cnt,init) \ |
967 | if (expect_false ((cnt) > (cur))) \ |
967 | if (expect_false ((cnt) > (cur))) \ |
968 | { \ |
968 | { \ |
969 | int ocur_ = (cur); \ |
969 | int ecb_unused ocur_ = (cur); \ |
970 | (base) = (type *)array_realloc \ |
970 | (base) = (type *)array_realloc \ |
971 | (sizeof (type), (base), &(cur), (cnt)); \ |
971 | (sizeof (type), (base), &(cur), (cnt)); \ |
972 | init ((base) + (ocur_), (cur) - ocur_); \ |
972 | init ((base) + (ocur_), (cur) - ocur_); \ |
973 | } |
973 | } |
974 | |
974 | |
… | |
… | |
1417 | ev_io_start (EV_A_ &pipe_w); |
1417 | ev_io_start (EV_A_ &pipe_w); |
1418 | ev_unref (EV_A); /* watcher should not keep loop alive */ |
1418 | ev_unref (EV_A); /* watcher should not keep loop alive */ |
1419 | } |
1419 | } |
1420 | } |
1420 | } |
1421 | |
1421 | |
1422 | inline_size void |
1422 | inline_speed void |
1423 | evpipe_write (EV_P_ EV_ATOMIC_T *flag) |
1423 | evpipe_write (EV_P_ EV_ATOMIC_T *flag) |
1424 | { |
1424 | { |
1425 | if (!*flag) |
1425 | if (!*flag) |
1426 | { |
1426 | { |
1427 | *flag = 1; |
1427 | *flag = 1; |
1428 | |
1428 | |
1429 | pipe_write_skipped = 1; |
1429 | pipe_write_skipped = 1; |
1430 | |
1430 | |
1431 | if (pipe_write_wanted) |
1431 | if (pipe_write_wanted) |
1432 | { |
1432 | { |
1433 | int old_errno = errno; /* save errno because write will clobber it */ |
1433 | int old_errno; |
1434 | char dummy; |
|
|
1435 | |
1434 | |
1436 | pipe_write_skipped = 0; |
1435 | pipe_write_skipped = 0; |
|
|
1436 | |
|
|
1437 | old_errno = errno; /* save errno because write will clobber it */ |
1437 | |
1438 | |
1438 | #if EV_USE_EVENTFD |
1439 | #if EV_USE_EVENTFD |
1439 | if (evfd >= 0) |
1440 | if (evfd >= 0) |
1440 | { |
1441 | { |
1441 | uint64_t counter = 1; |
1442 | uint64_t counter = 1; |
… | |
… | |
1447 | /* win32 people keep sending patches that change this write() to send() */ |
1448 | /* win32 people keep sending patches that change this write() to send() */ |
1448 | /* and then run away. but send() is wrong, it wants a socket handle on win32 */ |
1449 | /* and then run away. but send() is wrong, it wants a socket handle on win32 */ |
1449 | /* so when you think this write should be a send instead, please find out */ |
1450 | /* so when you think this write should be a send instead, please find out */ |
1450 | /* where your send() is from - it's definitely not the microsoft send, and */ |
1451 | /* where your send() is from - it's definitely not the microsoft send, and */ |
1451 | /* tell me. thank you. */ |
1452 | /* tell me. thank you. */ |
1452 | write (evpipe [1], &dummy, 1); |
1453 | write (evpipe [1], &(evpipe [1]), 1); |
1453 | } |
1454 | } |
1454 | |
1455 | |
1455 | errno = old_errno; |
1456 | errno = old_errno; |
1456 | } |
1457 | } |
1457 | } |
1458 | } |
… | |
… | |
1519 | |
1520 | |
1520 | if (!EV_A) |
1521 | if (!EV_A) |
1521 | return; |
1522 | return; |
1522 | #endif |
1523 | #endif |
1523 | |
1524 | |
1524 | evpipe_init (EV_A); |
1525 | if (!ev_active (&pipe_w)) |
|
|
1526 | return; |
1525 | |
1527 | |
1526 | signals [signum - 1].pending = 1; |
1528 | signals [signum - 1].pending = 1; |
1527 | evpipe_write (EV_A_ &sig_pending); |
1529 | evpipe_write (EV_A_ &sig_pending); |
1528 | } |
1530 | } |
1529 | |
1531 | |