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