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

Comparing Coro/README (file contents):
Revision 1.41 by root, Fri Aug 23 08:01:13 2019 UTC vs.
Revision 1.42 by root, Wed Jul 29 13:09:19 2020 UTC

891 $cb = rouse_cb 891 $cb = rouse_cb
892 Create and return a "rouse callback". That's a code reference that, 892 Create and return a "rouse callback". That's a code reference that,
893 when called, will remember a copy of its arguments and notify the 893 when called, will remember a copy of its arguments and notify the
894 owner coro of the callback. 894 owner coro of the callback.
895 895
896 Only the first invocation will store agruments and signal any waiter
897 - further calls will effectively be ignored, but it is ok to try.
898
896 See the next function. 899 Also see the next function.
897 900
898 @args = rouse_wait [$cb] 901 @args = rouse_wait [$cb]
899 Wait for the specified rouse callback (or the last one that was 902 Wait for the specified rouse callback to be invoked (or if the
900 created in this coro). 903 argument is missing, use the most recently created callback in the
904 current coro).
901 905
902 As soon as the callback is invoked (or when the callback was invoked 906 As soon as the callback is invoked (or when the callback was invoked
903 before "rouse_wait"), it will return the arguments originally passed 907 before "rouse_wait"), it will return the arguments originally passed
904 to the rouse callback. In scalar context, that means you get the 908 to the rouse callback. In scalar context, that means you get the
905 *last* argument, just as if "rouse_wait" had a "return ($a1, $a2, 909 *last* argument, just as if "rouse_wait" had a "return ($a1, $a2,
906 $a3...)" statement at the end. 910 $a3...)" statement at the end.
907 911
912 You are only allowed to wait once for a given rouse callback.
913
908 See the section HOW TO WAIT FOR A CALLBACK for an actual usage 914 See the section HOW TO WAIT FOR A CALLBACK for an actual usage
909 example. 915 example.
916
917 As of Coro 6.57, you can reliably wait for a rouse callback in a
918 different thread than from where it was created.
910 919
911HOW TO WAIT FOR A CALLBACK 920HOW TO WAIT FOR A CALLBACK
912 It is very common for a coro to wait for some callback to be called. 921 It is very common for a coro to wait for some callback to be called.
913 This occurs naturally when you use coro in an otherwise event-based 922 This occurs naturally when you use coro in an otherwise event-based
914 program, or when you use event-based libraries. 923 program, or when you use event-based libraries.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines