joeyadams/haskell-chat-server-example — comment on commit 94c128177c3af8c13b4b3f7b36256e11078acabe
File: Main.hs line 133
By joeyadams:

Actually, I don't think it's a problem in this case. The tryPutMVar is for waking up the outer thread to kill the worker threads. If the outer thread prevents a worker thread from calling tryPutMVar, it's okay: the outer thread has already been woken up. Only if the worker forks a thread to kill itself would this be a problem.

Do note that serveLoop itself is not async exception safe. It shouldn't need to be, since I never kill it. Nonetheless, I wrote an async exception safe version [in another branch][1]. Let me know if you spot any holes in it.

[1]: https://github.com/joeyadams/haskell-chat-server-example/blob/async-safe-serveLoop/Main.hs#L126