… | |
… | |
59 | |
59 | |
60 | # if HAVE_KQUEUE && HAVE_SYS_EVENT_H && HAVE_SYS_QUEUE_H && !defined (EV_USE_KQUEUE) |
60 | # if HAVE_KQUEUE && HAVE_SYS_EVENT_H && HAVE_SYS_QUEUE_H && !defined (EV_USE_KQUEUE) |
61 | # define EV_USE_KQUEUE 1 |
61 | # define EV_USE_KQUEUE 1 |
62 | # endif |
62 | # endif |
63 | |
63 | |
|
|
64 | # if HAVE_PORT_H && HAVE_PORT_H && HAVE_PORT_CREATE && !defined (EV_USE_PORT) |
|
|
65 | # define EV_USE_PORT 1 |
|
|
66 | # endif |
|
|
67 | |
64 | #endif |
68 | #endif |
65 | |
69 | |
66 | #include <math.h> |
70 | #include <math.h> |
67 | #include <stdlib.h> |
71 | #include <stdlib.h> |
68 | #include <fcntl.h> |
72 | #include <fcntl.h> |
… | |
… | |
93 | |
97 | |
94 | #ifndef EV_USE_MONOTONIC |
98 | #ifndef EV_USE_MONOTONIC |
95 | # define EV_USE_MONOTONIC 1 |
99 | # define EV_USE_MONOTONIC 1 |
96 | #endif |
100 | #endif |
97 | |
101 | |
|
|
102 | #ifndef EV_USE_REALTIME |
|
|
103 | # define EV_USE_REALTIME 1 |
|
|
104 | #endif |
|
|
105 | |
98 | #ifndef EV_USE_SELECT |
106 | #ifndef EV_USE_SELECT |
99 | # define EV_USE_SELECT 1 |
107 | # define EV_USE_SELECT 1 |
100 | # define EV_SELECT_USE_FD_SET 1 |
108 | # define EV_SELECT_USE_FD_SET 1 |
101 | #endif |
109 | #endif |
102 | |
110 | |
… | |
… | |
114 | |
122 | |
115 | #ifndef EV_USE_KQUEUE |
123 | #ifndef EV_USE_KQUEUE |
116 | # define EV_USE_KQUEUE 0 |
124 | # define EV_USE_KQUEUE 0 |
117 | #endif |
125 | #endif |
118 | |
126 | |
119 | #ifndef EV_USE_REALTIME |
127 | #ifndef EV_USE_PORT |
120 | # define EV_USE_REALTIME 1 |
128 | # define EV_USE_PORT 0 |
121 | #endif |
129 | #endif |
122 | |
130 | |
123 | /**/ |
131 | /**/ |
124 | |
132 | |
125 | /* darwin simply cannot be helped */ |
133 | /* darwin simply cannot be helped */ |
… | |
… | |
710 | |
718 | |
711 | #endif |
719 | #endif |
712 | |
720 | |
713 | /*****************************************************************************/ |
721 | /*****************************************************************************/ |
714 | |
722 | |
|
|
723 | #if EV_USE_PORT |
|
|
724 | # include "ev_port.c" |
|
|
725 | #endif |
715 | #if EV_USE_KQUEUE |
726 | #if EV_USE_KQUEUE |
716 | # include "ev_kqueue.c" |
727 | # include "ev_kqueue.c" |
717 | #endif |
728 | #endif |
718 | #if EV_USE_EPOLL |
729 | #if EV_USE_EPOLL |
719 | # include "ev_epoll.c" |
730 | # include "ev_epoll.c" |
… | |
… | |
778 | |
789 | |
779 | if (!(flags & 0x0000ffff)) |
790 | if (!(flags & 0x0000ffff)) |
780 | flags |= 0x0000ffff; |
791 | flags |= 0x0000ffff; |
781 | |
792 | |
782 | method = 0; |
793 | method = 0; |
|
|
794 | #if EV_USE_PORT |
|
|
795 | if (!method && (flags & EVMETHOD_PORT )) method = port_init (EV_A_ flags); |
|
|
796 | #endif |
783 | #if EV_USE_KQUEUE |
797 | #if EV_USE_KQUEUE |
784 | if (!method && (flags & EVMETHOD_KQUEUE)) method = kqueue_init (EV_A_ flags); |
798 | if (!method && (flags & EVMETHOD_KQUEUE)) method = kqueue_init (EV_A_ flags); |
785 | #endif |
799 | #endif |
786 | #if EV_USE_EPOLL |
800 | #if EV_USE_EPOLL |
787 | if (!method && (flags & EVMETHOD_EPOLL )) method = epoll_init (EV_A_ flags); |
801 | if (!method && (flags & EVMETHOD_EPOLL )) method = epoll_init (EV_A_ flags); |
… | |
… | |
801 | void |
815 | void |
802 | loop_destroy (EV_P) |
816 | loop_destroy (EV_P) |
803 | { |
817 | { |
804 | int i; |
818 | int i; |
805 | |
819 | |
|
|
820 | #if EV_USE_PORT |
|
|
821 | if (method == EVMETHOD_PORT ) port_destroy (EV_A); |
|
|
822 | #endif |
806 | #if EV_USE_KQUEUE |
823 | #if EV_USE_KQUEUE |
807 | if (method == EVMETHOD_KQUEUE) kqueue_destroy (EV_A); |
824 | if (method == EVMETHOD_KQUEUE) kqueue_destroy (EV_A); |
808 | #endif |
825 | #endif |
809 | #if EV_USE_EPOLL |
826 | #if EV_USE_EPOLL |
810 | if (method == EVMETHOD_EPOLL ) epoll_destroy (EV_A); |
827 | if (method == EVMETHOD_EPOLL ) epoll_destroy (EV_A); |
… | |
… | |
833 | } |
850 | } |
834 | |
851 | |
835 | static void |
852 | static void |
836 | loop_fork (EV_P) |
853 | loop_fork (EV_P) |
837 | { |
854 | { |
|
|
855 | #if EV_USE_PORT |
|
|
856 | if (method == EVMETHOD_PORT ) port_fork (EV_A); |
|
|
857 | #endif |
|
|
858 | #if EV_USE_KQUEUE |
|
|
859 | if (method == EVMETHOD_KQUEUE) kqueue_fork (EV_A); |
|
|
860 | #endif |
838 | #if EV_USE_EPOLL |
861 | #if EV_USE_EPOLL |
839 | if (method == EVMETHOD_EPOLL ) epoll_fork (EV_A); |
862 | if (method == EVMETHOD_EPOLL ) epoll_fork (EV_A); |
840 | #endif |
|
|
841 | #if EV_USE_KQUEUE |
|
|
842 | if (method == EVMETHOD_KQUEUE) kqueue_fork (EV_A); |
|
|
843 | #endif |
863 | #endif |
844 | |
864 | |
845 | if (ev_is_active (&sigev)) |
865 | if (ev_is_active (&sigev)) |
846 | { |
866 | { |
847 | /* default loop */ |
867 | /* default loop */ |