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

Comparing AnyEvent/README (file contents):
Revision 1.77 by root, Sat Sep 17 02:33:54 2016 UTC vs.
Revision 1.79 by root, Tue Feb 26 02:08:34 2019 UTC

826 Additionally, when the callback is invoked, it is also removed from 826 Additionally, when the callback is invoked, it is also removed from
827 the condvar (reset to "undef"), so the condvar does not keep a 827 the condvar (reset to "undef"), so the condvar does not keep a
828 reference to the callback after invocation. 828 reference to the callback after invocation.
829 829
830SUPPORTED EVENT LOOPS/BACKENDS 830SUPPORTED EVENT LOOPS/BACKENDS
831 The available backend classes are (every class has its own manpage): 831 The following backend classes are part of the AnyEvent distribution
832 (every class has its own manpage):
832 833
833 Backends that are autoprobed when no other event loop can be found. 834 Backends that are autoprobed when no other event loop can be found.
834 EV is the preferred backend when no other event loop seems to be in 835 EV is the preferred backend when no other event loop seems to be in
835 use. If EV is not installed, then AnyEvent will fall back to its own 836 use. If EV is not installed, then AnyEvent will fall back to its own
836 pure-perl implementation, which is available everywhere as it comes 837 pure-perl implementation, which is available everywhere as it comes
881 882
882 AnyEvent knows about both Prima and Wx, however, and will try to 883 AnyEvent knows about both Prima and Wx, however, and will try to
883 load POE when detecting them, in the hope that POE will pick them 884 load POE when detecting them, in the hope that POE will pick them
884 up, in which case everything will be automatic. 885 up, in which case everything will be automatic.
885 886
887 Known event loops outside the AnyEvent distribution
888 The following event loops or programs support AnyEvent by providing
889 their own AnyEvent backend. They will be picked up automatically.
890
891 urxvt::anyevent available to rxvt-unicode extensions
892
886GLOBAL VARIABLES AND FUNCTIONS 893GLOBAL VARIABLES AND FUNCTIONS
887 These are not normally required to use AnyEvent, but can be useful to 894 These are not normally required to use AnyEvent, but can be useful to
888 write AnyEvent extension modules. 895 write AnyEvent extension modules.
889 896
890 $AnyEvent::MODEL 897 $AnyEvent::MODEL
914 $guard = AnyEvent::post_detect { BLOCK } 921 $guard = AnyEvent::post_detect { BLOCK }
915 Arranges for the code block to be executed as soon as the event 922 Arranges for the code block to be executed as soon as the event
916 model is autodetected (or immediately if that has already happened). 923 model is autodetected (or immediately if that has already happened).
917 924
918 The block will be executed *after* the actual backend has been 925 The block will be executed *after* the actual backend has been
919 detected ($AnyEvent::MODEL is set), but *before* any watchers have 926 detected ($AnyEvent::MODEL is set), so it is possible to do some
920 been created, so it is possible to e.g. patch @AnyEvent::ISA or do 927 initialisation only when AnyEvent is actually initialised - see the
921 other initialisations - see the sources of AnyEvent::Strict or
922 AnyEvent::AIO to see how this is used. 928 sources of AnyEvent::AIO to see how this is used.
923 929
924 The most common usage is to create some global watchers, without 930 The most common usage is to create some global watchers, without
925 forcing event module detection too early, for example, AnyEvent::AIO 931 forcing event module detection too early. For example, AnyEvent::AIO
926 creates and installs the global IO::AIO watcher in a "post_detect" 932 creates and installs the global IO::AIO watcher in a "post_detect"
927 block to avoid autodetecting the event module at load time. 933 block to avoid autodetecting the event module at load time.
928 934
929 If called in scalar or list context, then it creates and returns an 935 If called in scalar or list context, then it creates and returns an
930 object that automatically removes the callback again when it is 936 object that automatically removes the callback again when it is
946 # able to just C<undef $WATCHER> if the watcher causes them grief. 952 # able to just C<undef $WATCHER> if the watcher causes them grief.
947 953
948 $WATCHER ||= $guard; 954 $WATCHER ||= $guard;
949 955
950 @AnyEvent::post_detect 956 @AnyEvent::post_detect
951 If there are any code references in this array (you can "push" to it 957 This is a lower level interface then "AnyEvent::post_detect" (the
952 before or after loading AnyEvent), then they will be called directly 958 function). This variable is mainly useful for modules that can do
959 something useful when AnyEvent is used and thus want to know when it
960 is initialised, but do not need to even load it by default. This
961 array provides the means to hook into AnyEvent passively, without
962 loading it.
963
964 Here is how it works: If there are any code references in this array
965 (you can "push" to it before or after loading AnyEvent), then they
953 after the event loop has been chosen. 966 will be called directly after the event loop has been chosen.
954 967
955 You should check $AnyEvent::MODEL before adding to this array, 968 You should check $AnyEvent::MODEL before adding to this array,
956 though: if it is defined then the event loop has already been 969 though: if it is defined then the event loop has already been
957 detected, and the array will be ignored. 970 detected, and the array will be ignored.
958 971
959 Best use "AnyEvent::post_detect { BLOCK }" when your application 972 Best use "AnyEvent::post_detect { BLOCK }" when your application
960 allows it, as it takes care of these details. 973 allows it, as it takes care of these details.
961
962 This variable is mainly useful for modules that can do something
963 useful when AnyEvent is used and thus want to know when it is
964 initialised, but do not need to even load it by default. This array
965 provides the means to hook into AnyEvent passively, without loading
966 it.
967 974
968 Example: To load Coro::AnyEvent whenever Coro and AnyEvent are used 975 Example: To load Coro::AnyEvent whenever Coro and AnyEvent are used
969 together, you could put this into Coro (this is the actual code used 976 together, you could put this into Coro (this is the actual code used
970 by Coro to accomplish this): 977 by Coro to accomplish this):
971 978

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines