On Mon, Mar 28, 2011 at 8:06 AM, John Millikin <jmillikin@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.

Dave
 

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe