[Haskell-cafe] timely shutdown of timer threads

Warren Harris warrensomebody at gmail.com
Wed Feb 2 23:19:11 CET 2011


On Feb 2, 2011, at 2:02 PM, Johan Tibell wrote:

> On Wed, Feb 2, 2011 at 10:42 PM, Warren Harris <warrensomebody at gmail.com> wrote:
>> Interesting. I hadn't thought of this solution. You're forking the timer to yet a third thread so that if it continues waiting beyond the checkpoint thread shutdown it doesn't really matter. I guess that works as long as the main thread doesn't wait for all other threads to terminate before terminating the app.
>> 
>> It still seems to me that haskell is lacking when it comes to operations that can wait for multiple conditions.
> 
> I think we can make waiting for both I/O activity and timers at the
> same time using the I/O manager. I will need to do this for my planned
> timeout support in the network package.

I could see wanting to wait for an MVar, timeout, IO activity, STM channels (anything that could block), all in the same event handler. (Rather like the old WaitForMultipleObjects on Windows.) This would also require a way to test each condition without blocking (MVar has this with tryTakeMVar, but it doesn't look like they all support it.)

Warren


More information about the Haskell-Cafe mailing list