--- Coro/Coro.pm 2001/07/21 03:44:06 1.19 +++ Coro/Coro.pm 2001/07/22 03:24:10 1.21 @@ -25,6 +25,17 @@ This module is still experimental, see the BUGS section below. +In this module, coroutines are defined as "callchain + lexical variables ++ @_ + $_ + $@ + $^W), that is, a coroutine has it's own callchain, it's +own set of lexicals and it's own set of perl's most important global +variables. + +WARNING: When using this module, make sure that, at program end, no +coroutines are still running OR just call exit before falling off the +end. The reason for this is that some coroutine of yours might have called +into a C function, and falling off the end of main:: results in returning +to that C function instead if to the main C interpreter. + =cut package Coro; @@ -33,14 +44,12 @@ use base Exporter; -$VERSION = 0.09; +$VERSION = 0.10; @EXPORT = qw(async yield schedule terminate current); @EXPORT_OK = qw($current); { - use subs 'async'; - my @async; # this way of handling attributes simply is NOT scalable ;() @@ -62,7 +71,7 @@ } sub INIT { - async pop @async while @async; + &async(pop @async) while @async; } } @@ -173,6 +182,7 @@ sub terminate { $current->{_results} = [@_]; + delete $current->{_coro_state}; &schedule; } @@ -236,7 +246,7 @@ remaining bugs. - this module is not thread-safe. You must only ever use this module from the same thread (this requirement might be loosened in the future to - allow per-thread schedulers, but Coro::Satte does not yet allow this). + allow per-thread schedulers, but Coro::State does not yet allow this). =head1 SEE ALSO