X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FConc.lhs;h=f24b61d39d266f0161589345f9bfa0bd4b26d0b5;hb=43bfd296263020bd2045fc630b01d1f959318bd6;hp=0b6bc91385edf4ff19050ab5209cffe64d478acf;hpb=a058649879dc906e4e9c810ab5a0be4b2b878b14;p=haskell-directory.git diff --git a/GHC/Conc.lhs b/GHC/Conc.lhs index 0b6bc91..f24b61d 100644 --- a/GHC/Conc.lhs +++ b/GHC/Conc.lhs @@ -328,6 +328,15 @@ unsafeIOToSTM :: IO a -> STM a unsafeIOToSTM (IO m) = STM m -- |Perform a series of STM actions atomically. +-- +-- You cannot use 'atomically' inside an 'unsafePerformIO' or 'unsafeInterleaveIO'. +-- Any attempt to do so will result in a runtime error. (Reason: allowing +-- this would effectively allow a transaction inside a transaction, depending +-- on exactly when the thunk is evaluated.) +-- +-- However, see 'newTVarIO', which can be called inside 'unsafePerformIO', +-- and which allows top-level TVars to be allocated. + atomically :: STM a -> IO a atomically (STM m) = IO (\s -> (atomically# m) s )