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.132 by root, Sun May 25 01:05:27 2008 UTC vs.
Revision 1.133 by root, Sun May 25 03:44:03 2008 UTC

519The callback will be called when the condition becomes "true", i.e. when 519The callback will be called when the condition becomes "true", i.e. when
520C<send> or C<croak> are called. Calling C<recv> inside the callback 520C<send> or C<croak> are called. Calling C<recv> inside the callback
521or at any later time is guaranteed not to block. 521or at any later time is guaranteed not to block.
522 522
523=back 523=back
524
525=head3 MAINLOOP EMULATION
526
527Sometimes (often for short test scripts, or even standalone programs
528who only want to use AnyEvent), you I<do> want your program to block
529indefinitely in some event loop.
530
531In that case, you cna use a condition variable like this:
532
533 AnyEvent->condvar->recv;
534
535This has the effect of entering the event loop and looping forever.
536
537Note that usually your program has some exit condition, in which case
538it is better to use the "traditional" approach of storing a condition
539variable, waiting for it, and sending it when the program should exit
540cleanly.
541
524 542
525=head1 GLOBAL VARIABLES AND FUNCTIONS 543=head1 GLOBAL VARIABLES AND FUNCTIONS
526 544
527=over 4 545=over 4
528 546

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines