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

Comparing Coro/Coro.pm (file contents):
Revision 1.19 by root, Sat Jul 21 03:44:06 2001 UTC vs.
Revision 1.20 by root, Sat Jul 21 18:21:45 2001 UTC

23This module collection manages coroutines. Coroutines are similar to 23This module collection manages coroutines. Coroutines are similar to
24Threads but don't run in parallel. 24Threads but don't run in parallel.
25 25
26This module is still experimental, see the BUGS section below. 26This module is still experimental, see the BUGS section below.
27 27
28In this module, coroutines are defined as "callchain + lexical variables
29+ @_ + $_ + $@ + $^W), that is, a coroutine has it's own callchain, it's
30own set of lexicals and it's own set of perl's most important global
31variables.
32
28=cut 33=cut
29 34
30package Coro; 35package Coro;
31 36
32use Coro::State; 37use Coro::State;
33 38
34use base Exporter; 39use base Exporter;
35 40
36$VERSION = 0.09; 41$VERSION = 0.10;
37 42
38@EXPORT = qw(async yield schedule terminate current); 43@EXPORT = qw(async yield schedule terminate current);
39@EXPORT_OK = qw($current); 44@EXPORT_OK = qw($current);
40 45
41{ 46{
42 use subs 'async';
43
44 my @async; 47 my @async;
45 48
46 # this way of handling attributes simply is NOT scalable ;() 49 # this way of handling attributes simply is NOT scalable ;()
47 sub import { 50 sub import {
48 Coro->export_to_level(1, @_); 51 Coro->export_to_level(1, @_);
60 return $old ? $old->($package, $ref, @attrs) : @attrs; 63 return $old ? $old->($package, $ref, @attrs) : @attrs;
61 }; 64 };
62 } 65 }
63 66
64 sub INIT { 67 sub INIT {
65 async pop @async while @async; 68 &async(pop @async) while @async;
66 } 69 }
67} 70}
68 71
69=item $main 72=item $main
70 73
234 - if variables or arguments "disappear" (become undef) or become 237 - if variables or arguments "disappear" (become undef) or become
235 corrupted please contact the author so he cen iron out the 238 corrupted please contact the author so he cen iron out the
236 remaining bugs. 239 remaining bugs.
237 - this module is not thread-safe. You must only ever use this module from 240 - this module is not thread-safe. You must only ever use this module from
238 the same thread (this requirement might be loosened in the future to 241 the same thread (this requirement might be loosened in the future to
239 allow per-thread schedulers, but Coro::Satte does not yet allow this). 242 allow per-thread schedulers, but Coro::State does not yet allow this).
240 243
241=head1 SEE ALSO 244=head1 SEE ALSO
242 245
243L<Coro::Channel>, L<Coro::Cont>, L<Coro::Specific>, L<Coro::Semaphore>, 246L<Coro::Channel>, L<Coro::Cont>, L<Coro::Specific>, L<Coro::Semaphore>,
244L<Coro::Signal>, L<Coro::State>, L<Coro::Event>. 247L<Coro::Signal>, L<Coro::State>, L<Coro::Event>.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines