OxL Reference

fn shield

Runs body protected from cancellation (§8.6).

Example:

oxl✓ checked in CI
fn main() io {
  let r = shield(() => 6 * 7)
  print("{r}")
}
Output
42
@intrinsic("shield") pub(api) fn shield<T, effect F>(body: fn() -> T F) -> T  F

Since. 1.0.0-beta

Parameters

NameType
bodyfn() -> T F

Returns

T F

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/task.oxl:152

See also