Use some I
to construct R
via a provided function, within a HotswapRef.
Use some I
to construct R
via a provided function, within a HotswapRef.
Calls to swapWith update the value of R
within HotswapRef with provided with some I
.
- Companion
- object
Value members
Concrete methods
Inherited methods
Access R
safely
Access R
safely
Note that access to R
is protected by a shared-mode lock via a cats.effect.kernel.Resource scope.
A resource R
with unreleased locks cannot be finalized and therefore cannot be fully swapped.
- Inherited from
- HotswapRef
Swap the current resource with a new version
Swap the current resource with a new version
This makes use of evalTap
on the provided cats.effect.kernel.Resource to ensure the
cats.effect.kernel.Ref with R
is updated immediately on allocation and may be used by access calls while
swap blocks, waiting for the previous cats.effect.kernel.Resource to finalize.
This means that while there is no previous finalization process in progress when this is called, R
may be
swapped in the holder ref, but will block until all references to R
are removed and R
is torn down.
A semaphore guarantees that concurrent access to swap will wait while previous resources are finalized.
- Inherited from
- HotswapRef