
Cale is a genius! This totally solves the timeouts. Why, though? The lock is only used at the end of the unpickling. Why does it help? On Dec 21, 2005, at 2:56 PM, Cale Gibbard wrote:
By the way, when I was doing threadDelays, I meant: trace s = withMVar lock $ const $ threadDelay 20 In case you didn't try that.
- Cale
On 21/12/05, Joel Reymont
wrote: I'm not sure I buy this. Again, this helps:
{-# NOINLINE lock #-} lock :: MVar () lock = unsafePerformIO $ newMVar ()
trace s = withMVar lock $ const $ putStrLn s
and then in read_
cmd <- read h trace
trace is called _after_ all the timings in read so it should not affect the timings.
You could basically say that the lock is at the end of read, after all the unpickling has been done. The other interesting thing is that replacing trace with
delay _ = threadDelay 1
does not solve the issue.