-
Notifications
You must be signed in to change notification settings - Fork 560
Open
Labels
Description
(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?
TomasMikula