zio.blocks.scope.DeferHandle
See theDeferHandle companion object
A handle returned by Scope.defer that allows cancelling a registered finalizer before the scope closes.
When scope.defer(cleanup) is called, the cleanup action is registered to run when the scope closes, and a DeferHandle is returned. The handle can be used to remove that finalizer early, attempting to prevent it from running when the scope closes. If cancellation races with scope closure, the finalizer may already be in the process of running. This is useful when a resource is explicitly released before the scope ends, and running the finalizer again would be unnecessary or harmful.
Attributes
- See also
-
Scope.defer for registering finalizers
- Companion
- object
- Source
- DeferHandle.scala
- Graph
-
- Supertypes
Members list
In this article