
11 Aug
2003
11 Aug
'03
7:04 a.m.
On Mon, Aug 11, 2003 at 11:11:38AM +0100, Simon Marlow wrote:
Can't you implement it like this:
unsafeInterleaveIO io = return (unsafePerformIO io)
That's exactly what's there now, and it doesn't produce interleaving. Hugs doesn't have a global thread pool -- each instance of unsafePerformIO has its own. Once the side computation starts, it runs to completion before returning to the main thread. Even if it yields, only threads spawned inside the unsafePerformIO can take over. A global thread pool doesn't seem feasible with the current implementation of concurrency in Hugs. Concurrency is implemented in the libraries; a blocked thread is a continuation, and it's not clear how to construct that continuation in a pure context.