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

Comparing Coro/Coro.pm (file contents):
Revision 1.18 by root, Sat Jul 21 02:49:09 2001 UTC vs.
Revision 1.19 by root, Sat Jul 21 03:44:06 2001 UTC

33 33
34use base Exporter; 34use base Exporter;
35 35
36$VERSION = 0.09; 36$VERSION = 0.09;
37 37
38@EXPORT = qw(async yield schedule terminate); 38@EXPORT = qw(async yield schedule terminate current);
39@EXPORT_OK = qw($current); 39@EXPORT_OK = qw($current);
40 40
41{ 41{
42 use subs 'async'; 42 use subs 'async';
43 43
72 72
73=cut 73=cut
74 74
75our $main = new Coro; 75our $main = new Coro;
76 76
77=item $current 77=item $current (or as function: current)
78 78
79The current coroutine (the last coroutine switched to). The initial value is C<$main> (of course). 79The current coroutine (the last coroutine switched to). The initial value is C<$main> (of course).
80 80
81=cut 81=cut
82 82
84if ($current) { 84if ($current) {
85 $main->{specific} = $current->{specific}; 85 $main->{specific} = $current->{specific};
86} 86}
87 87
88our $current = $main; 88our $current = $main;
89
90sub current() { $current }
89 91
90=item $idle 92=item $idle
91 93
92The coroutine to switch to when no other coroutine is running. The default 94The coroutine to switch to when no other coroutine is running. The default
93implementation prints "FATAL: deadlock detected" and exits. 95implementation prints "FATAL: deadlock detected" and exits.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines