[Haskell-cafe] ANNOUNCE: enumerator 0.4.8
leimy2k at gmail.com
Mon Mar 28 17:43:06 CEST 2011
On Mon, Mar 28, 2011 at 8:06 AM, John Millikin <jmillikin at gmail.com> wrote:
> On Sunday, March 27, 2011 9:45:23 PM UTC-7, Ertugrul Soeylemez wrote:
>> > For setting a global timeout on an entire session, it's better to wrap
>> > the ``run_`` call with ``System.Timeout.timeout`` -- this is more
>> > efficient than testing the time on every chunk, and does not require a
>> > specialised enumerator.
>> It may be more efficient, but I don't really like it. I like robust
>> applications, and to me killing a thread is always a mistake, even if
>> the thread is kill-safe.
> ``timeout`` doesn't kill the thread, it just returns ``Nothing`` if the
> computation took longer than expected.
Timeout does kill the thread that is used for timing out :-). The
thread that measures the timeout throws an exception to the worker
thread that's being monitored.
Either way you're interrupting a thread. Kill it or toss an exception
at it, I don't see the difference really.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe