ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent.pm (file contents):
Revision 1.300 by root, Tue Dec 1 17:56:28 2009 UTC vs.
Revision 1.302 by root, Fri Dec 4 16:31:57 2009 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines