anoma / juvix

A language for intent-centric and declarative decentralised applications
https://docs.juvix.org
GNU General Public License v3.0
442 stars 54 forks source link

Replace low level `forkIO` with a safer alternative #2806

Closed janmasrovira closed 3 weeks ago

janmasrovira commented 3 weeks ago

using forkIO is not recommended because:

async's high-level API spawns lexically scoped threads, ensuring the following key poperties that make it safer to use than using plain forkIO:

  • No exception is swallowed (waiting for results propagates exceptions).
  • No thread is leaked (left running unintentionally).

Recently we've observed some infinite loops when one of the threads was crashing and I suspect this could fix that issue. I don't have a concrete example to share.