by Michael Piz
A simple example of a receive broadcast timeout that relies on filicide/parricide to do its job.
The main fiber…
1.…forks a child fiber that waits the length of the timeout (here, 5 seconds), then…
2. …waits for a broadcast that, for demo purposes, will never arrive (in implementation, it would wait for an actual broadcast, of course), and…
3. …when "never" arrives (i.e. that actual broadcast), stops the timeout (child) fiber and confesses its murder in the log.
The child fiber…
1. …waits the length of the timeout period and…
2. …when the timeout period ends, stops the receive broadcast (parent) fiber and confesses its murder in the log.
Only one will survive! 😈 Who will it be? 🤔
Rate and review within the app in the Community section.