… | |
… | |
35 | =cut |
35 | =cut |
36 | |
36 | |
37 | package Coro; |
37 | package Coro; |
38 | |
38 | |
39 | BEGIN { |
39 | BEGIN { |
40 | $VERSION = 0.01; |
40 | $VERSION = 0.03; |
41 | |
41 | |
42 | require XSLoader; |
42 | require XSLoader; |
43 | XSLoader::load Coro, $VERSION; |
43 | XSLoader::load Coro, $VERSION; |
44 | } |
44 | } |
45 | |
45 | |
… | |
… | |
90 | eval { &$proc->resume }; |
90 | eval { &$proc->resume }; |
91 | if ($@) { |
91 | if ($@) { |
92 | ($error_msg, $error_coro) = ($@, $current); |
92 | ($error_msg, $error_coro) = ($@, $current); |
93 | $error->resume; |
93 | $error->resume; |
94 | } |
94 | } |
95 | } while (); |
95 | } while (1); |
96 | }, $class; |
96 | }, $class; |
97 | } |
97 | } |
98 | |
98 | |
99 | =item $coro->resume |
99 | =item $coro->resume |
100 | |
100 | |
… | |
… | |
102 | |
102 | |
103 | =cut |
103 | =cut |
104 | |
104 | |
105 | my $prev; |
105 | my $prev; |
106 | |
106 | |
|
|
107 | # I call the _transfer function from a pelr function |
|
|
108 | # because that way perl saves all important things on |
|
|
109 | # the stack. |
107 | sub resume { |
110 | sub resume { |
108 | $prev = $current; $current = $_[0]; |
111 | $prev = $current; $current = $_[0]; |
109 | _transfer($prev, $current); |
112 | _transfer($prev, $current); |
110 | } |
113 | } |
111 | |
114 | |