patch applied (ghc-6.6/packages/base): Prevent duplication of unsafePerformIO on a multiprocessor

Ian Lynagh igloo at earth.li
Fri Mar 23 20:42:19 EDT 2007


Tue Mar  6 06:54:24 PST 2007  Simon Marlow <simonmar at microsoft.com>
  * Prevent duplication of unsafePerformIO on a multiprocessor
  Fixes #986.  The idea is to add a new operation
  
    noDuplicate :: IO ()
  
  it is guaranteed that if two threads have executed noDuplicate, then
  they are not duplicating any computation.
  
  We now provide two new unsafe operations:
  
  unsafeDupablePerformIO    :: IO a -> a
  unsafeDupableInterleaveIO :: IO a -> IO a
  
  which are equivalent to the old unsafePerformIO and unsafeInterleaveIO
  respectively.  The new versions of these functions are defined as:
  
  unsafePerformIO    m = unsafeDupablePerformIO (noDuplicate >> m)
  unsafeInterleaveIO m = unsafeDupableInterleaveIO (noDuplicate >> m)

    M ./GHC/IOBase.lhs -12 +41


More information about the Cvs-libraries mailing list