[Openmcl-devel] [openmcl-devel] Throw "Thread Safe?"
gb at clozure.com
Wed Jan 24 14:07:00 PST 2007
In the 1.1 prereleases: yes, interrupts are disabled in unwind-protect
cleanup forms and in any stack-unwinding code between the point of
the THROW and the corresponding CATCH target. If interrupts were
enabled at the time that the CATCH was established, then any interrupt
that had been deferred during unwinding will be taken just before
the transfer to CATCH target (after all of that unwinding is complete.)
If an UNWIND-PROTECT cleanup form actually does something that needs
to be interruptible, it's necessary to use WITH-INTERRUPTS-ENABLED.
(This actually happens somewhere in the code which waits for external
processes to complete; some of that waiting occurred within an
unwind-protect cleanup, and interrupts needed to be explicitly enabled
in that case in order to make the wait interruptible.)
Note that (WITHOUT-INTERRUPTS (THROW ...)) wouldn't have the intended
effect, since the THROW would cause execution to exit the extent of
Prior to 1.1, interrupts could occur at arbitrary times during the
process of unwinding the stack and executing intervening cleanup
On Wed, 24 Jan 2007, David L. Rager wrote:
> Are interrupts enabled while executing a throw?
> Supposed I have thread A, and it is in the middle of executing
> (throw :my-tag)
> Then suppose before A finishes the throw that thread B attempts to interrupt
> thread A, where thread B executes
> (ccl:process-interrupt *A* (lambda () (throw :my-tag nil)))
> Should I wrap a (without-interrupts ...) around (throw :my-tag) or is this issue
> already addressed by OpenMCL?
> Thank you,
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
More information about the Openmcl-devel