[cpp-threads] pthreads cancellation
Alexander Terekhov
alexander.terekhov at gmail.com
Wed Apr 27 13:03:34 BST 2005
On 4/26/05, Boehm, Hans <hans.boehm at hp.com> wrote:
[...]
> Java got rid of anything resembling asynchronous cancellation
Really?
http://www.rtj.org/rtsj-V1.0.pdf
"The interrupt() method in java.lang.Thread provides rudimentary
asynchronous communication by setting a pollable/resettable flag
in the target thread, and by throwing a synchronous exception
when the target thread is blocked at an invocation of wait(),
sleep(), or join(). This specification extends the effect of
Thread.interrupt() and adds an overloaded version in
RealtimeThread, offering a more comprehensive and non-polling
asynchronous execution control facility. It is based on throwing
and propagating exceptions that, though asynchronous, are
deferred where necessary in order to avoid data structure
corruption.
[...]
When a method is declared with AsynchronouslyInterruptedException
in its throws clause the platform is expected to asynchronously
throw this exception if RealtimeThread.interrupt() is called while
the method is executing, or if such an interrupt is pending any
time control returns to the method. The interrupt is not thrown
while any methods it invokes are executing, unless they are, in
turn, declared to throw the exception. This is intended to allow
long-running computations to be terminated without the overhead
or latency of polling with java.lang.Thread.interrupted()"
Please visit also
http://www.codesourcery.com/archives/c++-pthreads/msg00124.html
http://www.codesourcery.com/archives/c++-pthreads/msg00144.html
regards,
alexander.
More information about the cpp-threads
mailing list