Philosophen mit STM

kein Deadlock (trivial).

forM [ 1 .. num ] $ \ p -> forkIO $ forever $ do
    atomically $ do 
        take $ left  p
        take $ right p
    atomically $ drop $ left  p
    atomically $ drop $ right p
take f = do
    busy <- readTVar f
    when busy $ retry
    writeTVar f True
nicht fair.



Johannes Waldmann 2011-06-29