… | |
… | |
1131 | package AnyEvent; |
1131 | package AnyEvent; |
1132 | |
1132 | |
1133 | # basically a tuned-down version of common::sense |
1133 | # basically a tuned-down version of common::sense |
1134 | sub common_sense { |
1134 | sub common_sense { |
1135 | # from common:.sense 1.0 |
1135 | # from common:.sense 1.0 |
1136 | ${^WARNING_BITS} = "\xfc\x3f\xf3\x00\x0f\xf3\xcf\xc0\xf3\xfc\x33\x03"; |
1136 | ${^WARNING_BITS} = "\xfc\x3f\x33\x00\x0f\xf3\xcf\xc0\xf3\xfc\x33\x03"; |
1137 | # use strict vars subs |
1137 | # use strict vars subs |
1138 | $^H |= 0x00000600; |
1138 | $^H |= 0x00000600; |
1139 | } |
1139 | } |
1140 | |
1140 | |
1141 | BEGIN { AnyEvent::common_sense } |
1141 | BEGIN { AnyEvent::common_sense } |
… | |
… | |
2448 | it's built-in modules) are required to use it. |
2448 | it's built-in modules) are required to use it. |
2449 | |
2449 | |
2450 | That does not mean that AnyEvent won't take advantage of some additional |
2450 | That does not mean that AnyEvent won't take advantage of some additional |
2451 | modules if they are installed. |
2451 | modules if they are installed. |
2452 | |
2452 | |
2453 | This section epxlains which additional modules will be used, and how they |
2453 | This section explains which additional modules will be used, and how they |
2454 | affect AnyEvent's operation. |
2454 | affect AnyEvent's operation. |
2455 | |
2455 | |
2456 | =over 4 |
2456 | =over 4 |
2457 | |
2457 | |
2458 | =item L<Async::Interrupt> |
2458 | =item L<Async::Interrupt> |
… | |
… | |
2524 | |
2524 | |
2525 | Most event libraries are not fork-safe. The ones who are usually are |
2525 | Most event libraries are not fork-safe. The ones who are usually are |
2526 | because they rely on inefficient but fork-safe C<select> or C<poll> |
2526 | because they rely on inefficient but fork-safe C<select> or C<poll> |
2527 | calls. Only L<EV> is fully fork-aware. |
2527 | calls. Only L<EV> is fully fork-aware. |
2528 | |
2528 | |
|
|
2529 | This means that, in general, you cannot fork and do event processing |
|
|
2530 | in the child if a watcher was created before the fork (which in turn |
|
|
2531 | initialises the event library). |
|
|
2532 | |
2529 | If you have to fork, you must either do so I<before> creating your first |
2533 | If you have to fork, you must either do so I<before> creating your first |
2530 | watcher OR you must not use AnyEvent at all in the child OR you must do |
2534 | watcher OR you must not use AnyEvent at all in the child OR you must do |
2531 | something completely out of the scope of AnyEvent. |
2535 | something completely out of the scope of AnyEvent. |
|
|
2536 | |
|
|
2537 | The problem of doing event processing in the parent I<and> the child |
|
|
2538 | is much more complicated: even for backends that I<are> fork-aware or |
|
|
2539 | fork-safe, their behaviour is not usually what you want: fork clones all |
|
|
2540 | watchers, that means all timers, I/O watchers etc. are active in both |
|
|
2541 | parent and child, which is almost never what you want. |
2532 | |
2542 | |
2533 | |
2543 | |
2534 | =head1 SECURITY CONSIDERATIONS |
2544 | =head1 SECURITY CONSIDERATIONS |
2535 | |
2545 | |
2536 | AnyEvent can be forced to load any event model via |
2546 | AnyEvent can be forced to load any event model via |