I need to give a little warning. A source from BoundedChan shows that this is no exception. If you know that you are free of exceptions, for example, you avoid killThread, then everything will be fine. If you need a bulletproof library, you will need to improve BoundedChan . An exceptionally secure library will use withMVar or bracket instead of takeMVar and putMVar .
Using STM avoids most of the exception security problem, and this can be compiled using System.Timeout . In addition, the timeout was wrapped in several ways on Hackage .
source share