… | |
… | |
69 | |
69 | |
70 | =head2 API |
70 | =head2 API |
71 | |
71 | |
72 | See the EVAPI.h header. |
72 | See the EVAPI.h header. |
73 | |
73 | |
|
|
74 | In short, all the functions and macros from F<ev.h> should work, except |
|
|
75 | that the trailing underscore macros (C<EV_A_>, C<EV_DEFAULT_>) are not |
|
|
76 | available (except C<EV_P_> :). |
|
|
77 | |
|
|
78 | Multiplicity is enabled. |
|
|
79 | |
|
|
80 | The C<data> member in each watcher is of type C<SV *> and not C<void *> |
|
|
81 | (this might change at some point). |
|
|
82 | |
|
|
83 | =head2 EXAMPLE |
|
|
84 | |
|
|
85 | The L<EV::Glib>, L<EV::ADNS> and L<Glib::EV> all give nice examples on how |
|
|
86 | to use this module. |
|
|
87 | |
|
|
88 | Here are some F<.xs> fragments taken from EV::ADNS that should get you |
|
|
89 | going: |
|
|
90 | |
|
|
91 | #include "EVAPI.h" |
|
|
92 | |
|
|
93 | static ev_prepare pw; |
|
|
94 | static ev_idle iw; |
|
|
95 | |
|
|
96 | static void |
|
|
97 | idle_cb (EV_P_ ev_idle *w, int revents) |
|
|
98 | { |
|
|
99 | ev_idle_stop (EV_A, w); |
|
|
100 | } |
|
|
101 | |
|
|
102 | MODULE = ... |
|
|
103 | |
|
|
104 | BOOT: |
|
|
105 | { |
|
|
106 | I_EV_API ("EV::ADNS"); |
|
|
107 | ev_prepare_init (&pw, prepare_cb); |
|
|
108 | ev_init (&iw, idle_cb); ev_set_priority (&iw, EV_MINPRI); |
|
|
109 | ev_idle_start (EV_DEFAULT, &iw); |
|
|
110 | } |
|
|
111 | |
74 | =cut |
112 | =cut |
|
|
113 | |