… | |
… | |
476 | |
476 | |
477 | #if EV_USE_MONOTONIC |
477 | #if EV_USE_MONOTONIC |
478 | static EV_ATOMIC_T have_monotonic; /* did clock_gettime (CLOCK_MONOTONIC) work? */ |
478 | static EV_ATOMIC_T have_monotonic; /* did clock_gettime (CLOCK_MONOTONIC) work? */ |
479 | #endif |
479 | #endif |
480 | |
480 | |
|
|
481 | #ifndef EV_FD_TO_WIN32_HANDLE |
|
|
482 | # define EV_FD_TO_WIN32_HANDLE(fd) _get_osfhandle (fd) |
|
|
483 | #endif |
|
|
484 | #ifndef EV_WIN32_HANDLE_TO_FD |
|
|
485 | # define EV_WIN32_HANDLE_TO_FD(handle) _open_osfhandle (fd, 0) |
|
|
486 | #endif |
|
|
487 | #ifndef EV_WIN32_CLOSE_FD |
|
|
488 | # define EV_WIN32_CLOSE_FD(fd) close (fd) |
|
|
489 | #endif |
|
|
490 | |
481 | #ifdef _WIN32 |
491 | #ifdef _WIN32 |
482 | # include "ev_win32.c" |
492 | # include "ev_win32.c" |
483 | #endif |
493 | #endif |
484 | |
494 | |
485 | /*****************************************************************************/ |
495 | /*****************************************************************************/ |
… | |
… | |
876 | |
886 | |
877 | #if EV_SELECT_IS_WINSOCKET |
887 | #if EV_SELECT_IS_WINSOCKET |
878 | if (events) |
888 | if (events) |
879 | { |
889 | { |
880 | unsigned long arg; |
890 | unsigned long arg; |
881 | #ifdef EV_FD_TO_WIN32_HANDLE |
|
|
882 | anfd->handle = EV_FD_TO_WIN32_HANDLE (fd); |
891 | anfd->handle = EV_FD_TO_WIN32_HANDLE (fd); |
883 | #else |
|
|
884 | anfd->handle = _get_osfhandle (fd); |
|
|
885 | #endif |
|
|
886 | assert (("libev: only socket fds supported in this configuration", ioctlsocket (anfd->handle, FIONREAD, &arg) == 0)); |
892 | assert (("libev: only socket fds supported in this configuration", ioctlsocket (anfd->handle, FIONREAD, &arg) == 0)); |
887 | } |
893 | } |
888 | #endif |
894 | #endif |
889 | |
895 | |
890 | { |
896 | { |
… | |
… | |
1621 | close (evfd); |
1627 | close (evfd); |
1622 | #endif |
1628 | #endif |
1623 | |
1629 | |
1624 | if (evpipe [0] >= 0) |
1630 | if (evpipe [0] >= 0) |
1625 | { |
1631 | { |
1626 | close (evpipe [0]); |
1632 | EV_WIN32_CLOSE_FD (evpipe [0]); |
1627 | close (evpipe [1]); |
1633 | EV_WIN32_CLOSE_FD (evpipe [1]); |
1628 | } |
1634 | } |
1629 | } |
1635 | } |
1630 | |
1636 | |
1631 | #if EV_USE_SIGNALFD |
1637 | #if EV_USE_SIGNALFD |
1632 | if (ev_is_active (&sigfd_w)) |
1638 | if (ev_is_active (&sigfd_w)) |
… | |
… | |
1728 | close (evfd); |
1734 | close (evfd); |
1729 | #endif |
1735 | #endif |
1730 | |
1736 | |
1731 | if (evpipe [0] >= 0) |
1737 | if (evpipe [0] >= 0) |
1732 | { |
1738 | { |
1733 | close (evpipe [0]); |
1739 | EV_WIN32_CLOSE_FD (evpipe [0]); |
1734 | close (evpipe [1]); |
1740 | EV_WIN32_CLOSE_FD (evpipe [1]); |
1735 | } |
1741 | } |
1736 | |
1742 | |
1737 | evpipe_init (EV_A); |
1743 | evpipe_init (EV_A); |
1738 | /* now iterate over everything, in case we missed something */ |
1744 | /* now iterate over everything, in case we missed something */ |
1739 | pipecb (EV_A_ &pipe_w, EV_READ); |
1745 | pipecb (EV_A_ &pipe_w, EV_READ); |