… | |
… | |
47 | the current coroutine. |
47 | the current coroutine. |
48 | |
48 | |
49 | While this seems to work superficially, it will eventually cause memory |
49 | While this seems to work superficially, it will eventually cause memory |
50 | corruption. |
50 | corruption. |
51 | |
51 | |
|
|
52 | =head1 SEMANTICS |
|
|
53 | |
|
|
54 | Whenever Event blocks (e.g. in a call to C<one_event>, C<loop> etc.), |
|
|
55 | this module cede's to all other coroutines with the same or higher |
|
|
56 | priority. When any coroutines of lower priority are ready, it will not |
|
|
57 | block but run one of them and then check for events. |
|
|
58 | |
|
|
59 | The effect is that coroutines with the same or higher priority than |
|
|
60 | the blocking coroutine will keep Event from checking for events, while |
|
|
61 | coroutines with lower priority are being run, but Event checks for new |
|
|
62 | events after every cede. |
|
|
63 | |
52 | =head1 FUNCTIONS |
64 | =head1 FUNCTIONS |
53 | |
65 | |
54 | =over 4 |
66 | =over 4 |
55 | |
67 | |
56 | =cut |
68 | =cut |
… | |
… | |
71 | use base Exporter::; |
83 | use base Exporter::; |
72 | |
84 | |
73 | our @EXPORT = qw(loop unloop sweep); |
85 | our @EXPORT = qw(loop unloop sweep); |
74 | |
86 | |
75 | BEGIN { |
87 | BEGIN { |
76 | our $VERSION = 1.9; |
88 | our $VERSION = '2.0'; |
77 | |
89 | |
78 | local $^W = 0; # avoid redefine warning for Coro::ready; |
90 | local $^W = 0; # avoid redefine warning for Coro::ready; |
79 | XSLoader::load __PACKAGE__, $VERSION; |
91 | XSLoader::load __PACKAGE__, $VERSION; |
80 | } |
92 | } |
81 | |
93 | |