EffectTalk

Sharing Ref across fibers

Pass a Ref to multiple fibers to share state. Each fiber can Ref.get and Ref.update—updates are atomic. No locks needed; Ref handles concurrent access safely.

  • Create Ref once, pass to Effect.all or forked fibers
  • Ref.update is atomic—safe for concurrent access
  • Use Ref instead of mutable variables with fibers
Loading code editor...