Parallel and Concurrent Programming in Haskell by Simon Marlow
Author:Simon Marlow
Language: eng
Format: epub, mobi, pdf
Tags: COMPUTERS / Programming Languages / General
ISBN: 9781449335892
Publisher: O’Reilly Media
Published: 2013-07-11T16:00:00+00:00
writeChan :: Chan a -> a -> IO () writeChan (Chan _ writeVar) val = do newHole <- newEmptyMVar oldHole <- takeMVar writeVar putMVar oldHole (Item val newHole) putMVar writeVar newHole
To make the code exception-safe, our first thought might be to try this:
wrongWriteChan :: Chan a -> a -> IO () wrongWriteChan (Chan _ writeVar) val = do newHole <- newEmptyMVar modifyMVar_ writeVar $ \oldHole -> do putMVar oldHole (Item val newHole) -- return newHole --
But that doesn’t work because an asynchronous exception could strike between and . This would leave the old_hole full and writeVar pointing to it, which violates the invariants of the data structure. Hence we need to prevent that possibility too, and the simplest way is just to mask_ the whole sequence:
Download
Parallel and Concurrent Programming in Haskell by Simon Marlow.mobi
Parallel and Concurrent Programming in Haskell by Simon Marlow.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12563)
Hello! Python by Anthony Briggs(9911)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9794)
The Mikado Method by Ola Ellnestam Daniel Brolund(9775)
Dependency Injection in .NET by Mark Seemann(9335)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8292)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7758)
Grails in Action by Glen Smith Peter Ledbrook(7693)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7019)
Microservices with Go by Alexander Shuiskov(6787)
Practical Design Patterns for Java Developers by Miroslav Wengner(6699)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6639)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6409)
Angular Projects - Third Edition by Aristeidis Bampakos(6047)
The Art of Crafting User Stories by The Art of Crafting User Stories(5579)
NetSuite for Consultants - Second Edition by Peter Ries(5510)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5313)
Kotlin in Action by Dmitry Jemerov(5061)
