(Based on this comment by @TomasMikula; I'm opening a new issue, because approximately nobody reads closed issues.)
The idea is to have a new method on GenSpawn like this (name TBD):
def forkWithFinalizer[A](fa: F[A], fin: F[Unit]): F[Fiber[F, A]]
It would be different from start in that if this method returned a fiber, then fin would be guaranteed to be executed (except of course if fa hangs). There is no such gurarantee with start.
A new method on GenSpawn would require a default implementation. A possibility is in #4500.
Open questions:
- Do we actually want something like this on the public API?
- Are we okay with the default implementation? (I think it works, but I've been wrong before.)
- What to name the method?
(Based on this comment by @TomasMikula; I'm opening a new issue, because approximately nobody reads closed issues.)
The idea is to have a new method on
GenSpawnlike this (name TBD):It would be different from
startin that if this method returned a fiber, thenfinwould be guaranteed to be executed (except of course iffahangs). There is no such gurarantee withstart.A new method on
GenSpawnwould require a default implementation. A possibility is in #4500.Open questions: