… | |
… | |
3281 | |
3281 | |
3282 | Choosing a model is hard - look around, learn, know that usually you can do |
3282 | Choosing a model is hard - look around, learn, know that usually you can do |
3283 | better than you currently do :-) |
3283 | better than you currently do :-) |
3284 | |
3284 | |
3285 | =item * often you need to talk to some other thread which blocks in the |
3285 | =item * often you need to talk to some other thread which blocks in the |
|
|
3286 | event loop. |
|
|
3287 | |
3286 | event loop - C<ev_async> watchers can be used to wake them up from other |
3288 | C<ev_async> watchers can be used to wake them up from other threads safely |
3287 | threads safely (or from signal contexts...). |
3289 | (or from signal contexts...). |
3288 | |
3290 | |
3289 | =item * some watcher types are only supported in the default loop - use |
3291 | An example use would be to communicate signals or other events that only |
3290 | C<ev_async> watchers to tell your other loops about any such events. |
3292 | work in the default loop by registering the signal watcher with the |
|
|
3293 | default loop and triggering an C<ev_async> watcher from the default loop |
|
|
3294 | watcher callback into the event loop interested in the signal. |
3291 | |
3295 | |
3292 | =back |
3296 | =back |
3293 | |
3297 | |
3294 | =head2 COROUTINES |
3298 | =head2 COROUTINES |
3295 | |
3299 | |
… | |
… | |
3298 | coroutines (e.g. you can call C<ev_loop> on the same loop from two |
3302 | coroutines (e.g. you can call C<ev_loop> on the same loop from two |
3299 | different coroutines and switch freely between both coroutines running the |
3303 | different coroutines and switch freely between both coroutines running the |
3300 | loop, as long as you don't confuse yourself). The only exception is that |
3304 | loop, as long as you don't confuse yourself). The only exception is that |
3301 | you must not do this from C<ev_periodic> reschedule callbacks. |
3305 | you must not do this from C<ev_periodic> reschedule callbacks. |
3302 | |
3306 | |
3303 | Care has been invested into making sure that libev does not keep local |
3307 | Care has been taken to ensure that libev does not keep local state inside |
3304 | state inside C<ev_loop>, and other calls do not usually allow coroutine |
3308 | C<ev_loop>, and other calls do not usually allow coroutine switches. |
3305 | switches. |
|
|
3306 | |
3309 | |
3307 | |
3310 | |
3308 | =head1 COMPLEXITIES |
3311 | =head1 COMPLEXITIES |
3309 | |
3312 | |
3310 | In this section the complexities of (many of) the algorithms used inside |
3313 | In this section the complexities of (many of) the algorithms used inside |