[GHC] #14810: Define MVar "This function is atomic only if there are no other producers for this MVar."

#14810: Define MVar "This function is atomic only if there are no other producers for this MVar." -------------------------------------+------------------------------------- Reporter: akfp | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: | Version: 8.2.2 libraries/base | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Documentation Unknown/Multiple | bug Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The sentence: This function is atomic only if there are no other producers for this MVar. Is repeated lots of times in the Control.Concurrent.MVar documentation. However, there is no definition of what "producers for an MVar" means. There needs to be a definition of producer (and consumer I guess). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14810 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14810: Define MVar "This function is atomic only if there are no other producers for this MVar." -------------------------------------+------------------------------------- Reporter: akfp | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by akfp): The sentence might need to link to the section: "In particular, the "bigger" functions in this module (readMVar, swapMVar, withMVar, modifyMVar_ and modifyMVar) are simply the composition of a takeMVar followed by a putMVar with exception safety. These only have atomicity guarantees if all other threads perform a takeMVar before a putMVar as well; otherwise, they may block." or that section needs to define "producer". -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14810#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14810: Define MVar "This function is atomic only if there are no other producers for this MVar." -------------------------------------+------------------------------------- Reporter: akfp | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by osa1): Agreed that the documentation should be improved. I was also confused about this some time ago. Producer simply means "putMVar". For example, `swapMVar` takes the current value and puts a new value. If another thread puts between the `swapMVar`s take and put, `swapMVar` blocks and other threads observe the intermediate step, so it won't be atomic in this case. Similarly consumer means "takeMVar". Would you like to open a pull request? I think we accept documentation patches via Github PRs these days. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14810#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC