mirror of
https://github.com/barrucadu/dejafu.git
synced 2025-01-01 18:22:35 +03:00
Implement IO's 'spawn' in terms of other conc primitives
This commit is contained in:
parent
9361499b01
commit
070d034de9
@ -35,9 +35,9 @@ class Monad m => ConcFuture future m | m -> future where
|
||||
|
||||
instance ConcFuture MVar IO where
|
||||
spawn ma = do
|
||||
mvar <- newEmptyMVar
|
||||
void . forkIO $ ma >>= putMVar mvar
|
||||
return mvar
|
||||
cvar <- new
|
||||
fork $ ma >>= put cvar
|
||||
return cvar
|
||||
|
||||
get = readMVar
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user