RE: [Haskell-cafe] readMVar and the devils

2004-07-07 Thread Simon Marlow
On 06 July 2004 11:29, Conor T McBride wrote: > OK, here's what I want, what I do with it, and my attempt to deliver > it. But I'm not an expert, so please let me know if there's some > disastrous flaw... > > The signature/spec: > > type Hole x > > hole :: IO (Hole x) >-- returns a fresh em

Re: [Haskell-cafe] readMVar and the devils

2004-07-07 Thread Conor T McBride
Hi folks I had a bit more of a play over the weekend. Got addicted. Lumps of code further on down. Jan-Willem Maessen wrote: >If you're really using MVars in write-once read-many style, the >semantics of readMVar shouldn't be a problem: > >* Before the initializing write, all calls to readMVar bloc

Re: [Haskell-cafe] readMVar and the devils

2004-07-06 Thread Benjamin Franksen
On Friday 02 July 2004 15:59, you wrote: > > at a guess the magic take put is: > > > > block ( do > > a <- takeMVar x > > putMVar x a > > ) > > return a > > This doesn't prevent the race condition Conor mentioned. It only > prevents the thread executing the above code from being interrupted > by an

Re: [Haskell-cafe] readMVar and the devils

2004-07-02 Thread Jan-Willem Maessen - Sun Labs East
Conor T McBride wrote: ... [questions about operation ordering with MVars] > I'm only asking, because I'm trying to cook up some kind of partial evaluator for programs which are being simultaneously edited by fiercely argumentative devils. Kind of `demonic laziness', where the computations decide w

Re: [Haskell-cafe] readMVar and the devils

2004-07-02 Thread Andy Moran
> at a guess the magic take put is: > > block ( do > a <- takeMVar x > putMVar x a > ) > return a This doesn't prevent the race condition Conor mentioned. It only prevents the thread executing the above code from being interrupted by an asynchronous exception (i.e., Control-C, or another thread

RE: [Haskell-cafe] readMVar and the devils

2004-07-02 Thread Simon Marlow
On 02 July 2004 10:16, Conor T McBride wrote: > Hi folks > > I'm having a play with Concurrent Haskell, and came across this in the > library. > >readMVar :: MVar a -> IO a >This is a combination of takeMVar and putMVar; ie. it takes the >value from the MVar, puts it back, and also r

Re: [Haskell-cafe] readMVar and the devils

2004-07-02 Thread MR K P SCHUPKE
at a guess the magic take put is: block ( do a <- takeMVar x putMVar x a ) return a Keean. ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] readMVar and the devils

2004-07-02 Thread Conor T McBride
Hi folks I'm having a play with Concurrent Haskell, and came across this in the library. readMVar :: MVar a -> IO a This is a combination of takeMVar and putMVar; ie. it takes the value from the MVar, puts it back, and also returns it. I was just wondering if I understand things correctly. Su