… | |
… | |
131 | #endif |
131 | #endif |
132 | |
132 | |
133 | struct loop_ref |
133 | struct loop_ref |
134 | { |
134 | { |
135 | |
135 | |
136 | loop_ref (EV_P) |
136 | loop_ref (EV_P) throw () |
137 | #if EV_MULTIPLICITY |
137 | #if EV_MULTIPLICITY |
138 | throw (bad_loop) : EV_AX (EV_A) |
138 | : EV_AX (EV_A) |
139 | { |
139 | #endif |
140 | if (!EV_AX) |
|
|
141 | throw bad_loop (); |
|
|
142 | } |
140 | { |
143 | #else |
|
|
144 | throw () |
|
|
145 | { |
141 | } |
146 | } |
|
|
147 | #endif |
|
|
148 | |
142 | |
149 | bool operator == (const loop_ref &other) const throw () |
143 | bool operator == (const loop_ref &other) const throw () |
150 | { |
144 | { |
151 | #if EV_MULTIPLICITY |
145 | #if EV_MULTIPLICITY |
152 | return EV_AX == other.EV_AX; |
146 | return EV_AX == other.EV_AX; |
… | |
… | |
163 | return false; |
157 | return false; |
164 | #endif |
158 | #endif |
165 | } |
159 | } |
166 | |
160 | |
167 | #if EV_MULTIPLICITY |
161 | #if EV_MULTIPLICITY |
168 | bool operator== (struct ev_loop *other) const throw () |
162 | bool operator == (struct ev_loop *other) const throw () |
169 | { |
163 | { |
170 | return this->EV_AX == other; |
164 | return this->EV_AX == other; |
171 | } |
165 | } |
172 | |
166 | |
173 | bool operator!= (struct ev_loop *other) const throw () |
167 | bool operator != (struct ev_loop *other) const throw () |
174 | { |
168 | { |
175 | return ! (*this == other); |
169 | return ! (*this == other); |
176 | } |
170 | } |
177 | |
171 | |
178 | bool operator== (const struct ev_loop *other) const throw () |
172 | bool operator == (const struct ev_loop *other) const throw () |
179 | { |
173 | { |
180 | return this->EV_AX == other; |
174 | return this->EV_AX == other; |
181 | } |
175 | } |
182 | |
176 | |
183 | bool operator!= (const struct ev_loop *other) const throw () |
177 | bool operator != (const struct ev_loop *other) const throw () |
184 | { |
178 | { |
185 | return (*this == other); |
179 | return (*this == other); |
186 | } |
180 | } |
187 | |
181 | |
188 | operator struct ev_loop * () const throw () |
182 | operator struct ev_loop * () const throw () |
… | |
… | |
344 | #endif |
338 | #endif |
345 | |
339 | |
346 | }; |
340 | }; |
347 | |
341 | |
348 | #if EV_MULTIPLICITY |
342 | #if EV_MULTIPLICITY |
349 | struct dynamic_loop: loop_ref |
343 | struct dynamic_loop : loop_ref |
350 | { |
344 | { |
351 | |
345 | |
352 | dynamic_loop (unsigned int flags = AUTO) throw (bad_loop) |
346 | dynamic_loop (unsigned int flags = AUTO) throw (bad_loop) |
353 | : loop_ref (ev_loop_new (flags)) |
347 | : loop_ref (ev_loop_new (flags)) |
354 | { |
348 | { |
|
|
349 | if (!EV_AX) |
|
|
350 | throw bad_loop (); |
355 | } |
351 | } |
356 | |
352 | |
357 | ~dynamic_loop () throw () |
353 | ~dynamic_loop () throw () |
358 | { |
354 | { |
359 | ev_loop_destroy (EV_AX); |
355 | ev_loop_destroy (EV_AX); |
… | |
… | |
367 | dynamic_loop & operator= (const dynamic_loop &); |
363 | dynamic_loop & operator= (const dynamic_loop &); |
368 | |
364 | |
369 | }; |
365 | }; |
370 | #endif |
366 | #endif |
371 | |
367 | |
372 | struct default_loop: loop_ref |
368 | struct default_loop : loop_ref |
373 | { |
369 | { |
374 | |
370 | |
375 | default_loop (unsigned int flags = AUTO) throw (bad_loop) |
371 | default_loop (unsigned int flags = AUTO) throw (bad_loop) |
376 | #if EV_MULTIPLICITY |
372 | #if EV_MULTIPLICITY |
377 | : loop_ref (ev_default_loop (flags)) |
373 | : loop_ref (ev_default_loop (flags)) |
378 | #endif |
374 | #endif |
379 | { |
375 | { |
|
|
376 | if ( |
380 | #ifndef EV_MULTIPLICITY |
377 | #if EV_MULTIPLICITY |
|
|
378 | !EV_AX |
|
|
379 | #else |
381 | if (!ev_default_loop (flags)) |
380 | !ev_default_loop (flags) |
|
|
381 | #endif |
|
|
382 | ) |
382 | throw bad_loop (); |
383 | throw bad_loop (); |
383 | #endif |
|
|
384 | } |
384 | } |
385 | |
385 | |
386 | ~default_loop () throw () |
386 | ~default_loop () throw () |
387 | { |
387 | { |
388 | ev_default_destroy (); |
388 | ev_default_destroy (); |
… | |
… | |
695 | start (); |
695 | start (); |
696 | } |
696 | } |
697 | EV_END_WATCHER (sig, signal) |
697 | EV_END_WATCHER (sig, signal) |
698 | |
698 | |
699 | EV_BEGIN_WATCHER (child, child) |
699 | EV_BEGIN_WATCHER (child, child) |
700 | void set (int pid) throw () |
700 | void set (int pid, int trace = 0) throw () |
701 | { |
701 | { |
702 | int active = is_active (); |
702 | int active = is_active (); |
703 | if (active) stop (); |
703 | if (active) stop (); |
704 | ev_child_set (static_cast<ev_child *>(this), pid); |
704 | ev_child_set (static_cast<ev_child *>(this), pid, trace); |
705 | if (active) start (); |
705 | if (active) start (); |
706 | } |
706 | } |
707 | |
707 | |
708 | void start (int pid) throw () |
708 | void start (int pid, int trace = 0) throw () |
709 | { |
709 | { |
710 | set (pid); |
710 | set (pid, trace); |
711 | start (); |
711 | start (); |
712 | } |
712 | } |
713 | EV_END_WATCHER (child, child) |
713 | EV_END_WATCHER (child, child) |
714 | |
714 | |
715 | #if EV_STAT_ENABLE |
715 | #if EV_STAT_ENABLE |