Skip to content

Fork-with-finalizer method on GenSpawn #4517

@durban

Description

@durban

(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?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions