|(require ffi/unsafe/atomic)||package: base|
Disables and enables context switches and delivery of break exceptions at the level of Racket threads. Calls to start-atomic and end-atomic can be nested.
Using call-as-atomic is somewhat safer, in that call-as-atomic correctly catches exceptions and re-raises them after exiting atomic mode. For simple uses where exceptions need not be handled, however, start-atomic and end-atomic are faster.
Like start-atomic and end-atomic, but the delivery of break exceptions is not suspended. To ensure that a call to start-atomic is reliably paired with a call to end-atomic, use dynamic-wind pre- and post thunks or some other context where breaks are disabled. These variants are not faster than plain start-atomic and end-atomic.
Calls thunk in atomic mode. If thunk raises an exception, the exception is caught and re-raised after exiting atomic mode.
Within the dynamic extent of a call-as-atomic, calls thunk in non-atomic mode. Beware that the current thread may be suspended or terminated by other threads during the execution of thunk, in which case the call never returns.
Returns #t if Racket context switches are disabled, #f otherwise.