Time out

Simon Marlow simonmar@microsoft.com
Tue, 10 Sep 2002 17:26:11 +0100


> On Tuesday 10 September 2002 03:58 am, Simon Marlow wrote:
>=20
> > With asyncrhonous exceptions as they are implemented=20
> currently, you only
> > need one extra thread.  If we ever get around to changing=20
> the semantics
> > as per the async exceptions paper, then you'll probably need two
> > threads.
>=20
> How do they differ, precisely?  Is it whether throwTo is=20
> synchronous or=20
> asynchronous?  I seem to recall that we changed the semantics from=20
> synchronous to asynchronous, late-ish in the game, in order=20
> to stream-line the semantics.

I think it was also because we were having trouble implementing some of
the combinators in a robust way using the synchronous version.  The
problem is that with the synchronous semantics, throwTo must be an
interruptible operation, which makes it hard to guarantee not to raise
exceptions in certain critical regions.

> Is there any reason (other than lack of time)=20
> not to bring GHC in line with the paper?

I just have a niggling feeling that the asychronous version isn't really
the right thing.  For one, you can implement the asynchronous version
easily in terms of the synchronous version by forking a thread.  Also,
implementing the asychronous version natively is slightly more tricky.
And implementing some combinators (like timeout) require two threads
with the async version, but only one with the sync version.

Perhaps we should bite the bullet and have non-interruptible versions of
some of the blocking operations, including throwTo.

Cheers,
	Simon