This is entirely theoretical at this point, but I've been trying to wrap my head around this problem. Let's take a client for an example. There are forkIOd threads for every connection, and one of them wants to quit the entire program (ie. /exit). How would this information be propagated to other threads?
This is not a condition, but I assume that the threads are reading from
their respective threads which are blocking. Since they're idling away
until something is written for them, they can't poll any kind of "done"
variable. So my first thought unless done
is bunked.
I don't have a solution in mind for any program, so anyone giving solutions for any language is appreciated, but the real question is how to do it in Haskell.