
I submit that unsafeInterleaveIO hasn't worked on Hugs since at least July 2000 (when the implementation of concurrency was changed), and that it doesn't seem feasible to implement it with the current concurrency model. So I propose that we drop it from Hugs.
Can't you implement it like this: unsafeInterleaveIO io = return (unsafePerformIO io) I seem to recall some reason why we couldn't do this on GHC, it might have been something to do with the fact that this allows the argument to unsafeInterleaveIO to be performed *before* the unsafeInterleaveIO if the strictness analyser got hold of it, but this won't be a problem for Hugs. Cheers, Simon

"Simon Marlow"
I submit that unsafeInterleaveIO hasn't worked on Hugs since at least July 2000
Can't you implement it like this: unsafeInterleaveIO io = return (unsafePerformIO io)
Indeed, in the base package, System.IO.Unsafe has the following definition for nhc98, which amounts to the same thing: unsafeInterleaveIO f = let x = unsafePerformIO f in return x Regards, Malcolm

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.
participants (3)
-
Malcolm Wallace
-
Ross Paterson
-
Simon Marlow