MCPcopy Create free account
hub / github.com/Effect-TS/effect / invalidate

Function invalidate

packages/effect/src/internal/rcRef.ts:180–197  ·  view source on GitHub ↗
(
  self_: RcRef.RcRef<A, E>
)

Source from the content-addressed store, hash-verified

178
179/** @internal */
180export const invalidate = <A, E>(
181 self_: RcRef.RcRef<A, E>
182): Effect.Effect<void> => {
183 const self = self_ as RcRefImpl<A, E>
184 return Effect.uninterruptible(Effect.suspend(() => {
185 if (self.state._tag !== "Acquired") {
186 return Effect.void
187 }
188 const state = self.state
189 self.state = stateEmpty
190 state.invalidated = true
191 if (state.refCount > 0) {
192 return Effect.void
193 }
194 state.fiber?.interruptUnsafe()
195 return Scope.close(state.scope, Exit.void)
196 }))
197}

Callers

nothing calls this directly

Calls 2

interruptUnsafeMethod · 0.80
closeMethod · 0.65

Tested by

no test coverage detected