> The logical dual to tryTakeMVar would be > tryPutMVar :: MVar a -> a -> IO Bool tryPutMVar :: MVar a -> a -> IO Bool tryPutMVar m a = Exception.catchAllIO (do { putMVar m a; return True }) (\e -> case e of PutFullMVar -> return False _other -> throw e) > Or even > tryPutMVar :: MVar a -> IO a -> IO (Maybe a) > (the latter only if you can keep the MVar empty while you run > the action.) This one needs another lock, I guess. Cheers, Simon
- tryTakeMVar :: MVar a -> IO (Maybe a) Marcin 'Qrczak' Kowalczyk
- RE: tryTakeMVar :: MVar a -> IO (Maybe a... Sigbjorn Finne
- Re: tryTakeMVar :: MVar a -> IO (Maybe a... Marcin 'Qrczak' Kowalczyk
- Re: tryTakeMVar :: MVar a -> IO (Maybe a... Marcin 'Qrczak' Kowalczyk
- Re: tryTakeMVar :: MVar a -> IO (May... George Russell
- Re: tryTakeMVar :: MVar a -> IO (Maybe a... Marcin 'Qrczak' Kowalczyk
- Re: tryTakeMVar :: MVar a -> IO (May... George Russell
- RE: tryTakeMVar :: MVar a -> IO (Maybe a... Simon Peyton-Jones
- RE: tryTakeMVar :: MVar a -> IO (Maybe a... Simon Marlow
- Re: tryTakeMVar :: MVar a -> IO (May... George Russell
- Simon Marlow