… | |
… | |
90 | }; |
90 | }; |
91 | print STDERR $@ if $@; |
91 | print STDERR $@ if $@; |
92 | _exit 255; |
92 | _exit 255; |
93 | } |
93 | } |
94 | |
94 | |
95 | sub new { |
|
|
96 | my $class = shift; |
|
|
97 | my $proc = shift || sub { die "tried to transfer to an empty coroutine" }; |
|
|
98 | bless _newprocess [$proc, @_], $class; |
|
|
99 | } |
|
|
100 | |
|
|
101 | =item $prev->transfer ($next, $flags) |
95 | =item $prev->transfer ($next, $flags) |
102 | |
96 | |
103 | Save the state of the current subroutine in C<$prev> and switch to the |
97 | Save the state of the current subroutine in C<$prev> and switch to the |
104 | coroutine saved in C<$next>. |
98 | coroutine saved in C<$next>. |
105 | |
99 | |