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

Comparing Coro/README (file contents):
Revision 1.30 by root, Wed Jun 29 17:58:52 2011 UTC vs.
Revision 1.41 by root, Fri Aug 23 08:01:13 2019 UTC

66CORO THREAD LIFE CYCLE 66CORO THREAD LIFE CYCLE
67 During the long and exciting (or not) life of a coro thread, it goes 67 During the long and exciting (or not) life of a coro thread, it goes
68 through a number of states: 68 through a number of states:
69 69
70 1. Creation 70 1. Creation
71 The first thing in the life of a coro thread is it's creation - 71 The first thing in the life of a coro thread is its creation -
72 obviously. The typical way to create a thread is to call the "async 72 obviously. The typical way to create a thread is to call the "async
73 BLOCK" function: 73 BLOCK" function:
74 74
75 async { 75 async {
76 # thread code goes here 76 # thread code goes here
85 This creates a new coro thread and puts it into the ready queue, 85 This creates a new coro thread and puts it into the ready queue,
86 meaning it will run as soon as the CPU is free for it. 86 meaning it will run as soon as the CPU is free for it.
87 87
88 "async" will return a Coro object - you can store this for future 88 "async" will return a Coro object - you can store this for future
89 reference or ignore it - a thread that is running, ready to run or 89 reference or ignore it - a thread that is running, ready to run or
90 waiting for some event is alive on it's own. 90 waiting for some event is alive on its own.
91 91
92 Another way to create a thread is to call the "new" constructor with 92 Another way to create a thread is to call the "new" constructor with
93 a code-reference: 93 a code-reference:
94 94
95 new Coro sub { 95 new Coro sub {
186 186
187 async { 187 async {
188 Coro::terminate "return value 1", "return value 2"; 188 Coro::terminate "return value 1", "return value 2";
189 }; 189 };
190 190
191 And yet another way is to "->cancel" (or "->safe_cancel") the coro 191 Yet another way is to "->cancel" (or "->safe_cancel") the coro
192 thread from another thread: 192 thread from another thread:
193 193
194 my $coro = async { 194 my $coro = async {
195 exit 1; 195 exit 1;
196 }; 196 };
209 So, cancelling a thread that runs in an XS event loop might not be 209 So, cancelling a thread that runs in an XS event loop might not be
210 the best idea, but any other combination that deals with perl only 210 the best idea, but any other combination that deals with perl only
211 (cancelling when a thread is in a "tie" method or an "AUTOLOAD" for 211 (cancelling when a thread is in a "tie" method or an "AUTOLOAD" for
212 example) is safe. 212 example) is safe.
213 213
214 Lastly, a coro thread object that isn't referenced is "->cancel"'ed 214 Last not least, a coro thread object that isn't referenced is
215 automatically - just like other objects in Perl. This is not such a 215 "->cancel"'ed automatically - just like other objects in Perl. This
216 common case, however - a running thread is referencedy b 216 is not such a common case, however - a running thread is referencedy
217 $Coro::current, a thread ready to run is referenced by the ready 217 by $Coro::current, a thread ready to run is referenced by the ready
218 queue, a thread waiting on a lock or semaphore is referenced by 218 queue, a thread waiting on a lock or semaphore is referenced by
219 being in some wait list and so on. But a thread that isn't in any of 219 being in some wait list and so on. But a thread that isn't in any of
220 those queues gets cancelled: 220 those queues gets cancelled:
221 221
222 async { 222 async {
224 }; 224 };
225 225
226 cede; 226 cede;
227 # now the async above is destroyed, as it is not referenced by anything. 227 # now the async above is destroyed, as it is not referenced by anything.
228 228
229 A slightly embellished example might make it clearer:
230
231 async {
232 my $guard = Guard::guard { print "destroyed\n" };
233 schedule while 1;
234 };
235
236 cede;
237
238 Superficially one might not expect any output - since the "async"
239 implements an endless loop, the $guard will not be cleaned up.
240 However, since the thread object returned by "async" is not stored
241 anywhere, the thread is initially referenced because it is in the
242 ready queue, when it runs it is referenced by $Coro::current, but
243 when it calls "schedule", it gets "cancel"ed causing the guard
244 object to be destroyed (see the next section), and printing its
245 message.
246
247 If this seems a bit drastic, remember that this only happens when
248 nothing references the thread anymore, which means there is no way
249 to further execute it, ever. The only options at this point are
250 leaking the thread, or cleaning it up, which brings us to...
251
229 5. Cleanup 252 5. Cleanup
230 Threads will allocate various resources. Most but not all will be 253 Threads will allocate various resources. Most but not all will be
231 returned when a thread terminates, during clean-up. 254 returned when a thread terminates, during clean-up.
232 255
233 Cleanup is quite similar to throwing an uncaught exception: perl 256 Cleanup is quite similar to throwing an uncaught exception: perl
234 will work it's way up through all subroutine calls and blocks. On 257 will work its way up through all subroutine calls and blocks. On its
235 it's way, it will release all "my" variables, undo all "local"'s and 258 way, it will release all "my" variables, undo all "local"'s and free
236 free any other resources truly local to the thread. 259 any other resources truly local to the thread.
237 260
238 So, a common way to free resources is to keep them referenced only 261 So, a common way to free resources is to keep them referenced only
239 by my variables: 262 by my variables:
240 263
241 async { 264 async {
250 273
251 my $sem = new Coro::Semaphore; 274 my $sem = new Coro::Semaphore;
252 275
253 async { 276 async {
254 my $lock_guard = $sem->guard; 277 my $lock_guard = $sem->guard;
255 # if we reutrn, or die or get cancelled, here, 278 # if we return, or die or get cancelled, here,
256 # then the semaphore will be "up"ed. 279 # then the semaphore will be "up"ed.
257 }; 280 };
258 281
259 The "Guard::guard" function comes in handy for any custom cleanup 282 The "Guard::guard" function comes in handy for any custom cleanup
260 you might want to do (but you cannot switch to other coroutines form 283 you might want to do (but you cannot switch to other coroutines from
261 those code blocks): 284 those code blocks):
262 285
263 async { 286 async {
264 my $window = new Gtk2::Window "toplevel"; 287 my $window = new Gtk2::Window "toplevel";
265 # The window will not be cleaned up automatically, even when $window 288 # The window will not be cleaned up automatically, even when $window
266 # gets freed, so use a guard to ensure it's destruction 289 # gets freed, so use a guard to ensure its destruction
267 # in case of an error: 290 # in case of an error:
268 my $window_guard = Guard::guard { $window->destroy }; 291 my $window_guard = Guard::guard { $window->destroy };
269 292
270 # we are safe here 293 # we are safe here
271 }; 294 };
282 6. Viva La Zombie Muerte 305 6. Viva La Zombie Muerte
283 Even after a thread has terminated and cleaned up its resources, the 306 Even after a thread has terminated and cleaned up its resources, the
284 Coro object still is there and stores the return values of the 307 Coro object still is there and stores the return values of the
285 thread. 308 thread.
286 309
287 The means the Coro object gets freed automatically when the thread 310 When there are no other references, it will simply be cleaned up and
288 has terminated and cleaned up and there arenot other references. 311 freed.
289 312
290 If there are, the Coro object will stay around, and you can call 313 If there areany references, the Coro object will stay around, and
291 "->join" as many times as you wish to retrieve the result values: 314 you can call "->join" as many times as you wish to retrieve the
315 result values:
292 316
293 async { 317 async {
294 print "hi\n"; 318 print "hi\n";
295 1 319 1
296 }; 320 };
316 }; 340 };
317 341
318GLOBAL VARIABLES 342GLOBAL VARIABLES
319 $Coro::main 343 $Coro::main
320 This variable stores the Coro object that represents the main 344 This variable stores the Coro object that represents the main
321 program. While you cna "ready" it and do most other things you can 345 program. While you can "ready" it and do most other things you can
322 do to coro, it is mainly useful to compare again $Coro::current, to 346 do to coro, it is mainly useful to compare again $Coro::current, to
323 see whether you are running in the main program or not. 347 see whether you are running in the main program or not.
324 348
325 $Coro::current 349 $Coro::current
326 The Coro object representing the current coro (the last coro that 350 The Coro object representing the current coro (the last coro that
393 program, as "async" does. As the coro is being reused, stuff like 417 program, as "async" does. As the coro is being reused, stuff like
394 "on_destroy" will not work in the expected way, unless you call 418 "on_destroy" will not work in the expected way, unless you call
395 terminate or cancel, which somehow defeats the purpose of pooling 419 terminate or cancel, which somehow defeats the purpose of pooling
396 (but is fine in the exceptional case). 420 (but is fine in the exceptional case).
397 421
398 The priority will be reset to 0 after each run, tracing will be 422 The priority will be reset to 0 after each run, all "swap_sv" calls
399 disabled, the description will be reset and the default output 423 will be undone, tracing will be disabled, the description will be
400 filehandle gets restored, so you can change all these. Otherwise the 424 reset and the default output filehandle gets restored, so you can
401 coro will be re-used "as-is": most notably if you change other 425 change all these. Otherwise the coro will be re-used "as-is": most
402 per-coro global stuff such as $/ you *must needs* revert that 426 notably if you change other per-coro global stuff such as $/ you
403 change, which is most simply done by using local as in: "local $/". 427 *must needs* revert that change, which is most simply done by using
428 local as in: "local $/".
404 429
405 The idle pool size is limited to 8 idle coros (this can be adjusted 430 The idle pool size is limited to 8 idle coros (this can be adjusted
406 by changing $Coro::POOL_SIZE), but there can be as many non-idle 431 by changing $Coro::POOL_SIZE), but there can be as many non-idle
407 coros as required. 432 coros as required.
408 433
509 # at this place, the timezone is Antarctica/South_Pole, 534 # at this place, the timezone is Antarctica/South_Pole,
510 # without disturbing the TZ of any other coro. 535 # without disturbing the TZ of any other coro.
511 }; 536 };
512 537
513 This can be used to localise about any resource (locale, uid, 538 This can be used to localise about any resource (locale, uid,
514 current working directory etc.) to a block, despite the existance of 539 current working directory etc.) to a block, despite the existence of
515 other coros. 540 other coros.
516 541
517 Another interesting example implements time-sliced multitasking 542 Another interesting example implements time-sliced multitasking
518 using interval timers (this could obviously be optimised, but does 543 using interval timers (this could obviously be optimised, but does
519 the job): 544 the job):
525 Coro::on_enter { 550 Coro::on_enter {
526 # on entering the thread, we set an VTALRM handler to cede 551 # on entering the thread, we set an VTALRM handler to cede
527 $SIG{VTALRM} = sub { cede }; 552 $SIG{VTALRM} = sub { cede };
528 # and then start the interval timer 553 # and then start the interval timer
529 Time::HiRes::setitimer &Time::HiRes::ITIMER_VIRTUAL, 0.01, 0.01; 554 Time::HiRes::setitimer &Time::HiRes::ITIMER_VIRTUAL, 0.01, 0.01;
530 }; 555 };
531 Coro::on_leave { 556 Coro::on_leave {
532 # on leaving the thread, we stop the interval timer again 557 # on leaving the thread, we stop the interval timer again
533 Time::HiRes::setitimer &Time::HiRes::ITIMER_VIRTUAL, 0, 0; 558 Time::HiRes::setitimer &Time::HiRes::ITIMER_VIRTUAL, 0, 0;
534 }; 559 };
535 560
536 &{+shift}; 561 &{+shift};
537 } 562 }
538 563
539 # use like this: 564 # use like this:
540 timeslice { 565 timeslice {
541 # The following is an endless loop that would normally 566 # The following is an endless loop that would normally
542 # monopolise the process. Since it runs in a timesliced 567 # monopolise the process. Since it runs in a timesliced
601 $state->is_new 626 $state->is_new
602 Returns true iff this Coro object is "new", i.e. has never been run 627 Returns true iff this Coro object is "new", i.e. has never been run
603 yet. Those states basically consist of only the code reference to 628 yet. Those states basically consist of only the code reference to
604 call and the arguments, but consumes very little other resources. 629 call and the arguments, but consumes very little other resources.
605 New states will automatically get assigned a perl interpreter when 630 New states will automatically get assigned a perl interpreter when
606 they are transfered to. 631 they are transferred to.
607 632
608 $state->is_zombie 633 $state->is_zombie
609 Returns true iff the Coro object has been cancelled, i.e. it's 634 Returns true iff the Coro object has been cancelled, i.e. its
610 resources freed because they were "cancel"'ed, "terminate"'d, 635 resources freed because they were "cancel"'ed, "terminate"'d,
611 "safe_cancel"'ed or simply went out of scope. 636 "safe_cancel"'ed or simply went out of scope.
612 637
613 The name "zombie" stems from UNIX culture, where a process that has 638 The name "zombie" stems from UNIX culture, where a process that has
614 exited and only stores and exit status and no other resources is 639 exited and only stores and exit status and no other resources is
626 651
627 $is_suspended = $coro->is_suspended 652 $is_suspended = $coro->is_suspended
628 Returns true iff this Coro object has been suspended. Suspended 653 Returns true iff this Coro object has been suspended. Suspended
629 Coros will not ever be scheduled. 654 Coros will not ever be scheduled.
630 655
631 $coro->cancel (arg...) 656 $coro->cancel ($arg...)
632 Terminates the given Coro thread and makes it return the given 657 Terminate the given Coro thread and make it return the given
633 arguments as status (default: an empty list). Never returns if the 658 arguments as status (default: an empty list). Never returns if the
634 Coro is the current Coro. 659 Coro is the current Coro.
635 660
636 This is a rather brutal way to free a coro, with some limitations - 661 This is a rather brutal way to free a coro, with some limitations -
637 if the thread is inside a C callback that doesn't expect to be 662 if the thread is inside a C callback that doesn't expect to be
638 canceled, bad things can happen, or if the cancelled thread insists 663 canceled, bad things can happen, or if the cancelled thread insists
639 on running complicated cleanup handlers that rely on its thread 664 on running complicated cleanup handlers that rely on its thread
640 context, things will not work. 665 context, things will not work.
641 666
642 Any cleanup code being run (e.g. from "guard" blocks) will be run 667 Any cleanup code being run (e.g. from "guard" blocks, destructors
643 without a thread context, and is not allowed to switch to other 668 and so on) will be run without a thread context, and is not allowed
669 to switch to other threads. A common mistake is to call "->cancel"
670 from a destructor called by die'ing inside the thread to be
671 cancelled for example.
672
644 threads. On the plus side, "->cancel" will always clean up the 673 On the plus side, "->cancel" will always clean up the thread, no
645 thread, no matter what. If your cleanup code is complex or you want 674 matter what. If your cleanup code is complex or you want to avoid
646 to avoid cancelling a C-thread that doesn't know how to clean up 675 cancelling a C-thread that doesn't know how to clean up itself, it
647 itself, it can be better to "->throw" an exception, or use 676 can be better to "->throw" an exception, or use "->safe_cancel".
648 "->safe_cancel".
649 677
650 The arguments to "->cancel" are not copied, but instead will be 678 The arguments to "->cancel" are not copied, but instead will be
651 referenced directly (e.g. if you pass $var and after the call change 679 referenced directly (e.g. if you pass $var and after the call change
652 that variable, then you might change the return values passed to 680 that variable, then you might change the return values passed to
653 e.g. "join", so don't do that). 681 e.g. "join", so don't do that).
658 actually destruct the Coro object. 686 actually destruct the Coro object.
659 687
660 $coro->safe_cancel ($arg...) 688 $coro->safe_cancel ($arg...)
661 Works mostly like "->cancel", but is inherently "safer", and 689 Works mostly like "->cancel", but is inherently "safer", and
662 consequently, can fail with an exception in cases the thread is not 690 consequently, can fail with an exception in cases the thread is not
663 in a cancellable state. 691 in a cancellable state. Essentially, "->safe_cancel" is a "->cancel"
692 with extra checks before canceling.
664 693
665 This method works a bit like throwing an exception that cannot be 694 It works a bit like throwing an exception that cannot be caught -
666 caught - specifically, it will clean up the thread from within 695 specifically, it will clean up the thread from within itself, so all
667 itself, so all cleanup handlers (e.g. "guard" blocks) are run with 696 cleanup handlers (e.g. "guard" blocks) are run with full thread
668 full thread context and can block if they wish. The downside is that 697 context and can block if they wish. The downside is that there is no
669 there is no guarantee that the thread can be cancelled when you call 698 guarantee that the thread can be cancelled when you call this
670 this method, and therefore, it might fail. It is also considerably 699 method, and therefore, it might fail. It is also considerably slower
671 slower than "cancel" or "terminate". 700 than "cancel" or "terminate".
672 701
673 A thread is in a safe-cancellable state if it either hasn't been run 702 A thread is in a safe-cancellable state if it either has never been
703 run yet, has already been canceled/terminated or otherwise
674 yet, or it has no C context attached and is inside an SLF function. 704 destroyed, or has no C context attached and is inside an SLF
705 function.
675 706
707 The first two states are trivial - a thread that hasnot started or
708 has already finished is safe to cancel.
709
676 The latter two basically mean that the thread isn't currently inside 710 The last state basically means that the thread isn't currently
677 a perl callback called from some C function (usually via some XS 711 inside a perl callback called from some C function (usually via some
678 modules) and isn't currently executing inside some C function itself 712 XS modules) and isn't currently executing inside some C function
679 (via Coro's XS API). 713 itself (via Coro's XS API).
680 714
681 This call returns true when it could cancel the thread, or croaks 715 This call returns true when it could cancel the thread, or croaks
682 with an error otherwise (i.e. it either returns true or doesn't 716 with an error otherwise (i.e. it either returns true or doesn't
683 return at all). 717 return at all).
684 718
749 from multiple threads, and all will be resumed and given the status 783 from multiple threads, and all will be resumed and given the status
750 return once the $coro terminates. 784 return once the $coro terminates.
751 785
752 $coro->on_destroy (\&cb) 786 $coro->on_destroy (\&cb)
753 Registers a callback that is called when this coro thread gets 787 Registers a callback that is called when this coro thread gets
754 destroyed, that is, after it's resources have been freed but before 788 destroyed, that is, after its resources have been freed but before
755 it is joined. The callback gets passed the terminate/cancel 789 it is joined. The callback gets passed the terminate/cancel
756 arguments, if any, and *must not* die, under any circumstances. 790 arguments, if any, and *must not* die, under any circumstances.
757 791
758 There can be any number of "on_destroy" callbacks per coro, and 792 There can be any number of "on_destroy" callbacks per coro, and
759 there is no way currently to remove a callback once added. 793 there is currently no way to remove a callback once added.
760 794
761 $oldprio = $coro->prio ($newprio) 795 $oldprio = $coro->prio ($newprio)
762 Sets (or gets, if the argument is missing) the priority of the coro 796 Sets (or gets, if the argument is missing) the priority of the coro
763 thread. Higher priority coro get run before lower priority coros. 797 thread. Higher priority coro get run before lower priority coros.
764 Priorities are small signed integers (currently -4 .. +3), that you 798 Priorities are small signed integers (currently -4 .. +3), that you
790 with a coro. 824 with a coro.
791 825
792 This method simply sets the "$coro->{desc}" member to the given 826 This method simply sets the "$coro->{desc}" member to the given
793 string. You can modify this member directly if you wish, and in 827 string. You can modify this member directly if you wish, and in
794 fact, this is often preferred to indicate major processing states 828 fact, this is often preferred to indicate major processing states
795 that cna then be seen for example in a Coro::Debug session: 829 that can then be seen for example in a Coro::Debug session:
796 830
797 sub my_long_function { 831 sub my_long_function {
798 local $Coro::current->{desc} = "now in my_long_function"; 832 local $Coro::current->{desc} = "now in my_long_function";
799 ... 833 ...
800 $Coro::current->{desc} = "my_long_function: phase 1"; 834 $Coro::current->{desc} = "my_long_function: phase 1";
829 otherwise you might suffer from crashes or worse. The only event 863 otherwise you might suffer from crashes or worse. The only event
830 library currently known that is safe to use without "unblock_sub" is 864 library currently known that is safe to use without "unblock_sub" is
831 EV (but you might still run into deadlocks if all event loops are 865 EV (but you might still run into deadlocks if all event loops are
832 blocked). 866 blocked).
833 867
834 Coro will try to catch you when you block in the event loop 868 Coro will try to catch you when you block in the event loop ("FATAL:
835 ("FATAL:$Coro::IDLE blocked itself"), but this is just best effort 869 $Coro::idle blocked itself"), but this is just best effort and only
836 and only works when you do not run your own event loop. 870 works when you do not run your own event loop.
837 871
838 This function allows your callbacks to block by executing them in 872 This function allows your callbacks to block by executing them in
839 another coro where it is safe to block. One example where blocking 873 another coro where it is safe to block. One example where blocking
840 is handy is when you use the Coro::AIO functions to save results to 874 is handy is when you use the Coro::AIO functions to save results to
841 disk, for example. 875 disk, for example.
878 It is very common for a coro to wait for some callback to be called. 912 It is very common for a coro to wait for some callback to be called.
879 This occurs naturally when you use coro in an otherwise event-based 913 This occurs naturally when you use coro in an otherwise event-based
880 program, or when you use event-based libraries. 914 program, or when you use event-based libraries.
881 915
882 These typically register a callback for some event, and call that 916 These typically register a callback for some event, and call that
883 callback when the event occured. In a coro, however, you typically want 917 callback when the event occurred. In a coro, however, you typically want
884 to just wait for the event, simplyifying things. 918 to just wait for the event, simplyifying things.
885 919
886 For example "AnyEvent->child" registers a callback to be called when a 920 For example "AnyEvent->child" registers a callback to be called when a
887 specific child has exited: 921 specific child has exited:
888 922
891 But from within a coro, you often just want to write this: 925 But from within a coro, you often just want to write this:
892 926
893 my $status = wait_for_child $pid; 927 my $status = wait_for_child $pid;
894 928
895 Coro offers two functions specifically designed to make this easy, 929 Coro offers two functions specifically designed to make this easy,
896 "Coro::rouse_cb" and "Coro::rouse_wait". 930 "rouse_cb" and "rouse_wait".
897 931
898 The first function, "rouse_cb", generates and returns a callback that, 932 The first function, "rouse_cb", generates and returns a callback that,
899 when invoked, will save its arguments and notify the coro that created 933 when invoked, will save its arguments and notify the coro that created
900 the callback. 934 the callback.
901 935
907 function mentioned above: 941 function mentioned above:
908 942
909 sub wait_for_child($) { 943 sub wait_for_child($) {
910 my ($pid) = @_; 944 my ($pid) = @_;
911 945
912 my $watcher = AnyEvent->child (pid => $pid, cb => Coro::rouse_cb); 946 my $watcher = AnyEvent->child (pid => $pid, cb => rouse_cb);
913 947
914 my ($rpid, $rstatus) = Coro::rouse_wait; 948 my ($rpid, $rstatus) = rouse_wait;
915 $rstatus 949 $rstatus
916 } 950 }
917 951
918 In the case where "rouse_cb" and "rouse_wait" are not flexible enough, 952 In the case where "rouse_cb" and "rouse_wait" are not flexible enough,
919 you can roll your own, using "schedule": 953 you can roll your own, using "schedule" and "ready":
920 954
921 sub wait_for_child($) { 955 sub wait_for_child($) {
922 my ($pid) = @_; 956 my ($pid) = @_;
923 957
924 # store the current coro in $current, 958 # store the current coro in $current,
927 my ($done, $rstatus); 961 my ($done, $rstatus);
928 962
929 # pass a closure to ->child 963 # pass a closure to ->child
930 my $watcher = AnyEvent->child (pid => $pid, cb => sub { 964 my $watcher = AnyEvent->child (pid => $pid, cb => sub {
931 $rstatus = $_[1]; # remember rstatus 965 $rstatus = $_[1]; # remember rstatus
932 $done = 1; # mark $rstatus as valud 966 $done = 1; # mark $rstatus as valid
967 $current->ready; # wake up the waiting thread
933 }); 968 });
934 969
935 # wait until the closure has been called 970 # wait until the closure has been called
936 schedule while !$done; 971 schedule while !$done;
937 972
1006 processes. What makes it so bad is that on non-windows platforms, you 1041 processes. What makes it so bad is that on non-windows platforms, you
1007 can actually take advantage of custom hardware for this purpose (as 1042 can actually take advantage of custom hardware for this purpose (as
1008 evidenced by the forks module, which gives you the (i-) threads API, 1043 evidenced by the forks module, which gives you the (i-) threads API,
1009 just much faster). 1044 just much faster).
1010 1045
1011 Sharing data is in the i-threads model is done by transfering data 1046 Sharing data is in the i-threads model is done by transferring data
1012 structures between threads using copying semantics, which is very slow - 1047 structures between threads using copying semantics, which is very slow -
1013 shared data simply does not exist. Benchmarks using i-threads which are 1048 shared data simply does not exist. Benchmarks using i-threads which are
1014 communication-intensive show extremely bad behaviour with i-threads (in 1049 communication-intensive show extremely bad behaviour with i-threads (in
1015 fact, so bad that Coro, which cannot take direct advantage of multiple 1050 fact, so bad that Coro, which cannot take direct advantage of multiple
1016 CPUs, is often orders of magnitude faster because it shares data using 1051 CPUs, is often orders of magnitude faster because it shares data using
1045 1080
1046 XS API: Coro::MakeMaker. 1081 XS API: Coro::MakeMaker.
1047 1082
1048 Low level Configuration, Thread Environment, Continuations: Coro::State. 1083 Low level Configuration, Thread Environment, Continuations: Coro::State.
1049 1084
1050AUTHOR 1085AUTHOR/SUPPORT/CONTACT
1051 Marc Lehmann <schmorp@schmorp.de> 1086 Marc A. Lehmann <schmorp@schmorp.de>
1052 http://home.schmorp.de/ 1087 http://software.schmorp.de/pkg/Coro.html
1053 1088

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines