… | |
… | |
668 | unsigned char emask; /* the epoll backend stores the actual kernel mask in here */ |
668 | unsigned char emask; /* the epoll backend stores the actual kernel mask in here */ |
669 | unsigned char unused; |
669 | unsigned char unused; |
670 | #if EV_USE_EPOLL |
670 | #if EV_USE_EPOLL |
671 | unsigned int egen; /* generation counter to counter epoll bugs */ |
671 | unsigned int egen; /* generation counter to counter epoll bugs */ |
672 | #endif |
672 | #endif |
673 | #if EV_SELECT_IS_WINSOCKET |
673 | #if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP |
674 | SOCKET handle; |
674 | SOCKET handle; |
|
|
675 | #endif |
|
|
676 | #if EV_USE_IOCP |
|
|
677 | OVERLAPPED or, ow; |
675 | #endif |
678 | #endif |
676 | } ANFD; |
679 | } ANFD; |
677 | |
680 | |
678 | /* stores the pending event set for a given watcher */ |
681 | /* stores the pending event set for a given watcher */ |
679 | typedef struct |
682 | typedef struct |
… | |
… | |
975 | unsigned char o_events = anfd->events; |
978 | unsigned char o_events = anfd->events; |
976 | unsigned char o_reify = anfd->reify; |
979 | unsigned char o_reify = anfd->reify; |
977 | |
980 | |
978 | anfd->reify = 0; |
981 | anfd->reify = 0; |
979 | |
982 | |
980 | #if EV_SELECT_IS_WINSOCKET |
983 | #if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP |
981 | if (o_reify & EV__IOFDSET) |
984 | if (o_reify & EV__IOFDSET) |
982 | { |
985 | { |
983 | unsigned long arg; |
986 | unsigned long arg; |
984 | anfd->handle = EV_FD_TO_WIN32_HANDLE (fd); |
987 | anfd->handle = EV_FD_TO_WIN32_HANDLE (fd); |
985 | assert (("libev: only socket fds supported in this configuration", ioctlsocket (anfd->handle, FIONREAD, &arg) == 0)); |
988 | assert (("libev: only socket fds supported in this configuration", ioctlsocket (anfd->handle, FIONREAD, &arg) == 0)); |
|
|
989 | printf ("oi %d %x\n", fd, anfd->handle);//D |
986 | } |
990 | } |
987 | #endif |
991 | #endif |
988 | |
992 | |
989 | /*if (expect_true (o_reify & EV_ANFD_REIFY)) probably a deoptimisation */ |
993 | /*if (expect_true (o_reify & EV_ANFD_REIFY)) probably a deoptimisation */ |
990 | { |
994 | { |
… | |
… | |
1489 | |
1493 | |
1490 | #endif |
1494 | #endif |
1491 | |
1495 | |
1492 | /*****************************************************************************/ |
1496 | /*****************************************************************************/ |
1493 | |
1497 | |
|
|
1498 | #if EV_USE_IOCP |
|
|
1499 | # include "ev_iocp.c" |
|
|
1500 | #endif |
1494 | #if EV_USE_PORT |
1501 | #if EV_USE_PORT |
1495 | # include "ev_port.c" |
1502 | # include "ev_port.c" |
1496 | #endif |
1503 | #endif |
1497 | #if EV_USE_KQUEUE |
1504 | #if EV_USE_KQUEUE |
1498 | # include "ev_kqueue.c" |
1505 | # include "ev_kqueue.c" |
… | |
… | |
1695 | #endif |
1702 | #endif |
1696 | |
1703 | |
1697 | if (!(flags & 0x0000ffffU)) |
1704 | if (!(flags & 0x0000ffffU)) |
1698 | flags |= ev_recommended_backends (); |
1705 | flags |= ev_recommended_backends (); |
1699 | |
1706 | |
|
|
1707 | #if EV_USE_IOCP |
|
|
1708 | if (!backend && (flags & EVBACKEND_IOCP )) backend = iocp_init (EV_A_ flags); |
|
|
1709 | #endif |
1700 | #if EV_USE_PORT |
1710 | #if EV_USE_PORT |
1701 | if (!backend && (flags & EVBACKEND_PORT )) backend = port_init (EV_A_ flags); |
1711 | if (!backend && (flags & EVBACKEND_PORT )) backend = port_init (EV_A_ flags); |
1702 | #endif |
1712 | #endif |
1703 | #if EV_USE_KQUEUE |
1713 | #if EV_USE_KQUEUE |
1704 | if (!backend && (flags & EVBACKEND_KQUEUE)) backend = kqueue_init (EV_A_ flags); |
1714 | if (!backend && (flags & EVBACKEND_KQUEUE)) backend = kqueue_init (EV_A_ flags); |
… | |
… | |
1756 | #endif |
1766 | #endif |
1757 | |
1767 | |
1758 | if (backend_fd >= 0) |
1768 | if (backend_fd >= 0) |
1759 | close (backend_fd); |
1769 | close (backend_fd); |
1760 | |
1770 | |
|
|
1771 | #if EV_USE_IOCP |
|
|
1772 | if (backend == EVBACKEND_IOCP ) iocp_destroy (EV_A); |
|
|
1773 | #endif |
1761 | #if EV_USE_PORT |
1774 | #if EV_USE_PORT |
1762 | if (backend == EVBACKEND_PORT ) port_destroy (EV_A); |
1775 | if (backend == EVBACKEND_PORT ) port_destroy (EV_A); |
1763 | #endif |
1776 | #endif |
1764 | #if EV_USE_KQUEUE |
1777 | #if EV_USE_KQUEUE |
1765 | if (backend == EVBACKEND_KQUEUE) kqueue_destroy (EV_A); |
1778 | if (backend == EVBACKEND_KQUEUE) kqueue_destroy (EV_A); |