5.10 Speculatively Atomic Execution
(require ffi/unsafe/try-atomic) | package: base |
procedure
(call-as-nonatomic-retry-point thunk) → any
thunk : (-> any)
procedure
(try-atomic thunk default-val [ #:should-give-up? give-up-proc #:keep-in-order? keep-in-order?]) → any thunk : (-> any) default-val : any/c give-up-proc : (-> any/c) = run-200-milliseconds keep-in-order? : any/c = #t
If keep-in-order? is true, then if try-atomic is called after an earlier computation was suspended for the same call-as-nonatomic-retry-point call, then thunk is immediately enqueued for completion by call-as-nonatomic-retry-point and default-val is returned.
The give-up-proc callback is polled only at points where the level of atomic-mode nesting (see start-atomic, start-breakable-atomic, and call-as-atomic) is the same as at the point of calling try-atomic.
If thunk aborts the current continuation using (default-continuation-prompt-tag), the abort is suspended the resumed by the enclosing call-as-nonatomic-retry-point. Escapes to the context of the call to thunk using any other prompt tag or continuation are blocked (using dynamic-wind) and simply return (void) from thunk.