ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Async-Interrupt/Interrupt.pm
(Generate patch)

Comparing cvsroot/Async-Interrupt/Interrupt.pm (file contents):
Revision 1.2 by root, Thu Jul 2 15:13:03 2009 UTC vs.
Revision 1.3 by root, Thu Jul 2 16:12:40 2009 UTC

38SIG_ATOMIC_MAX (guaranteed to allow at least 0..127). 38SIG_ATOMIC_MAX (guaranteed to allow at least 0..127).
39 39
40Since this kind of interruption is fast, but can only interrupt a 40Since this kind of interruption is fast, but can only interrupt a
41I<running> interpreter, there is optional support for also signalling a 41I<running> interpreter, there is optional support for also signalling a
42pipe - that means you can also wait for the pipe to become readable while 42pipe - that means you can also wait for the pipe to become readable while
43#TODO#
43 44
44=over 4 45=over 4
45 46
46=cut 47=cut
47 48
165C<$value> must be in the valid range for a C<sig_atomic_t> (0..127 is 166C<$value> must be in the valid range for a C<sig_atomic_t> (0..127 is
166portable). 167portable).
167 168
168=item $async->block 169=item $async->block
169 170
170Sometimes you need a "critical section" of code where
171
172=item $async->unblock 171=item $async->unblock
172
173Sometimes you need a "critical section" of code that will not be
174interrupted by an Async::Interrupt. This can be implemented by calling C<<
175$async->block >> before the critical section, and C<< $async->unblock >>
176afterwards.
177
178Note that there must be exactly one call of C<unblock> for ever<y previous
179call to C<block> (i.e. calls can nest).
180
181Since ensuring this in the presense of exceptions and threads is
182usually more difficult than you imagine, I recommend using C<<
183$async->scoped_block >> instead.
184
185=item $async->scope_block
186
187This call C<< $async->block >> and installs a handler that is called when
188the current scope is exited (via an exception, by canceling the Coro
189thread, by calling last/goto etc.).
190
191This is the recommended (and fastest) way to implement critical sections.
173 192
174=cut 193=cut
175 194
1761; 1951;
177 196

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines