1. 02 May, 2014 1 commit
    • Simon Marlow's avatar
      Per-thread allocation counters and limits · b0534f78
      Simon Marlow authored
      This tracks the amount of memory allocation by each thread in a
      counter stored in the TSO.  Optionally, when the counter drops below
      zero (it counts down), the thread can be sent an asynchronous
      exception: AllocationLimitExceeded.  When this happens, given a small
      additional limit so that it can handle the exception.  See
      documentation in GHC.Conc for more details.
      
      Allocation limits are similar to timeouts, but
      
        - timeouts use real time, not CPU time.  Allocation limits do not
          count anything while the thread is blocked or in foreign code.
      
        - timeouts don't re-trigger if the thread catches the exception,
          allocation limits do.
      
        - timeouts can catch non-allocating loops, if you use
          -fno-omit-yields.  This doesn't work for allocation limits.
      
      I couldn't measure any impact on benchmarks with these changes, even
      for nofib/smp.
      b0534f78
  2. 22 Sep, 2013 1 commit
  3. 17 Sep, 2013 1 commit
  4. 16 Feb, 2013 1 commit
  5. 12 Feb, 2013 1 commit
  6. 12 Jan, 2013 1 commit
  7. 27 Oct, 2012 1 commit
    • ian@well-typed.com's avatar
      Remove commented types in module export lists · fda30027
      ian@well-typed.com authored
      These comments are rather less useful now that haddock can give docs
      with the same informatino in the module synopsis.
      
      Having to maintain them when making changes to the library is a pain,
      and when people forget about doing so there is nothing that checks that
      the comments are right, so mistakes tend to linger.
      
      Of the comments that my script detected, 78 of 684 were already
      incorrect in one way or another, e.g. missing context:
          Text.Show.showsPrec
          Comment type: Int -> a -> ShowS
          Actual type:  Show a => Int -> a -> ShowS
      wrong context:
          Numeric.readInt
          Comment type: Integral a => a -> (Char -> Bool) -> (Char -> Int) -> ReadS a
          Actual type:  Num a => a -> (Char -> Bool) -> (Char -> Int) -> ReadS a
      not following a class change (e.g. Num losing its Eq superclass):
          Text.Read.Lex.readOctP
          Comment type: Num a => ReadP a
          Actual type:  (Eq a, Num a) => ReadP a
      not following the Exceptions change:
          GHC.Conc.childHandler
          Comment type: Exception -> IO ()
          Actual type:  SomeException -> IO ()
      or just always been wrong:
          GHC.Stable.deRefStablePtr
          Comment type: StablePtr a -> a
          Actual type:  StablePtr a -> IO a
      fda30027
  8. 12 Apr, 2012 1 commit
  9. 07 Dec, 2011 1 commit
  10. 06 Dec, 2011 1 commit
    • Simon Marlow's avatar
      add setNumCapabilities :: Int -> IO () · 637d7912
      Simon Marlow authored
      {- |
      Set the number of Haskell threads that can run truly simultaneously
      (on separate physical processors) at any given time.
      
      GHC notes: in the current implementation, the value may only be
      /increased/, not decreased, by calling 'setNumCapabilities'.  The
      initial value is given by the @+RTS -N@ flag, and the current value
      may be obtained using 'getNumCapabilities'.
      -}
      637d7912
  11. 25 Oct, 2011 1 commit
  12. 30 Mar, 2011 1 commit
    • Simon Marlow's avatar
      Export the affinity API from Control.Concurrent: forkOn and friends. · aec9d3e8
      Simon Marlow authored
      forkOn             :: Int -> IO () -> IO ThreadId
      forkOnWithUnmask   :: Int -> ((forall a . IO a -> IO a) -> IO ()) -> IO ThreadId
      getNumCapabilities :: IO Int
      threadCapability   :: ThreadId -> IO (Int, Bool)
      
      Following discussion on the libraries list, I renamed forkOnIO to
      forkOn.  In due course we might want to also rename forkIO to fork.
      
      I left the Int argument as it is, it's quite useful to be able to
      specify a number to be interpreted modulo the actual number of
      processors.
      
      I also used the term "capability" consistently.  It might not be the
      best choice, but we have to pick something.
      aec9d3e8
  13. 29 Mar, 2011 1 commit
    • Simon Marlow's avatar
      add forkIOWithUnmask, forkOnIOWithUnmask; deprecate forkIOUnmasked · 54c33b21
      Simon Marlow authored
          
      With forkIOUnmasked it wasn't possible to reliably set up an exception
      handler in the child thread, because exceptions were immediately
      unmasked.
      
      forkIOWithUnmask   ::        ((forall a . IO a -> IO a) -> IO ()) -> IO ThreadId
      forkOnIOWithUnmask :: Int -> ((forall a . IO a -> IO a) -> IO ()) -> IO ThreadId
      54c33b21
  14. 01 Mar, 2011 1 commit
    • Simon Marlow's avatar
      add threadCapability :: ThreadId -> IO (Int,Bool) · 06c59e58
      Simon Marlow authored
      -- | returns the number of the capability on which the thread is currently
      -- running, and a boolean indicating whether the thread is locked to
      -- that capability or not.  A thread is locked to a capability if it
      -- was created with @forkOnIO@.
      06c59e58
  15. 22 Dec, 2010 1 commit
    • Simon Marlow's avatar
      add getNumCapabilities :: IO Int · 6504ff9e
      Simon Marlow authored
        
      If we ever get around to implementing #3729 and #3210, then the number
      of capabilities will vary at runtime, so we need to move
      numCapabilities into the IO monad.
      6504ff9e
  16. 28 Jan, 2011 1 commit
  17. 06 Dec, 2010 1 commit
  18. 26 Nov, 2010 1 commit
    • bos's avatar
      Fix #4514 - IO manager deadlock · 79cf73c5
      bos authored
      * The public APIs for threadWaitRead and threadWaitWrite remain unchanged,
        and now throw an IOError if a file descriptor is closed behind their
        backs.  This behaviour is documented.
      
      * The GHC.Conc API is extended to add a closeFd function, the behaviour
        of which is documented.
      
      * Behind the scenes, we add a new evtClose event, which is used only when
        one thread closes a file descriptor that other threads are blocking on.
      
      * Both base's IO code and network use the new closeFd function.
      79cf73c5
  19. 26 Sep, 2010 2 commits
  20. 10 Aug, 2010 1 commit
  21. 20 Jul, 2010 1 commit
  22. 08 Jul, 2010 1 commit
    • Simon Marlow's avatar
      New asynchronous exception control API (base parts) · 73157075
      Simon Marlow authored
        
      As discussed on the libraries/haskell-cafe mailing lists
        http://www.haskell.org/pipermail/libraries/2010-April/013420.html
      
      This is a replacement for block/unblock in the asychronous exceptions
      API to fix a problem whereby a function could unblock asynchronous
      exceptions even if called within a blocked context.
      
      The new terminology is "mask" rather than "block" (to avoid confusion
      due to overloaded meanings of the latter).
      
      The following is the new API; the old API is deprecated but still
      available for the time being.
      
      Control.Exception
      -----------------
      
      mask  :: ((forall a. IO a -> IO a) -> IO b) -> IO b
      mask_ :: IO a -> IO a
      
      uninterruptibleMask :: ((forall a. IO a -> IO a) -> IO b) -> IO b
      uninterruptibleMask_ :: IO a -> IO 
      
      getMaskingState :: IO MaskingState
      
      data MaskingState
        = Unmasked
        | MaskedInterruptible 
        | MaskedUninterruptible
      
      
      Control.Concurrent
      ------------------
      
      forkIOUnmasked :: IO () -> IO ThreadId
      73157075
  23. 15 Jun, 2010 1 commit
  24. 16 May, 2010 1 commit
  25. 05 May, 2010 1 commit
  26. 13 Apr, 2010 1 commit
  27. 08 Mar, 2010 1 commit
  28. 25 Feb, 2010 1 commit
  29. 11 Nov, 2009 1 commit
    • Simon Marlow's avatar
      Second attempt to fix #1185 (forkProcess and -threaded) · e5b04f81
      Simon Marlow authored
      Patch 2/2: first patch is to ghc
      
      This time without dynamic linker hacks, instead I've expanded the
      existing rts/Globals.c to cache more CAFs, specifically those in
      GHC.Conc.  We were already using this trick for signal handlers, I
      should have realised before.
      
      It's still quite unsavoury, but we can do away with rts/Globals.c in
      the future when we switch to a dynamically-linked GHCi.
      e5b04f81
  30. 06 Nov, 2009 1 commit
    • Simon Marlow's avatar
      Rollback #1185 fix · 429156a9
      Simon Marlow authored
      rolling back:
      
      Tue Nov  3 16:05:40 GMT 2009  Simon Marlow <marlowsd@gmail.com>
        * Fix #1185: restart the IO manager after fork()
        
        This is the libraries/base part of the patch; there is a corresponding
        patch to GHC itself.
        
        The main change is that we now keep track of the IO manager's ThreadId
        in a top-level MVar, and ensureIOManagerIsRunning checks whether a
        previous IO manager thread is alive before starting one.  In the child
        of fork(), we can hence call ensureIOManagerIsRunning to restart the
        IO manager.
      
          M ./GHC/Conc.lhs -46 +44
      
      Wed Nov  4 17:49:45 GMT 2009  Ian Lynagh <igloo@earth.li>
        * Fix the build on Windows
      
          M ./GHC/Conc.lhs -6 +4
      429156a9
  31. 04 Nov, 2009 1 commit
  32. 03 Nov, 2009 1 commit
    • Simon Marlow's avatar
      Fix #1185: restart the IO manager after fork() · 23939c64
      Simon Marlow authored
      This is the libraries/base part of the patch; there is a corresponding
      patch to GHC itself.
      
      The main change is that we now keep track of the IO manager's ThreadId
      in a top-level MVar, and ensureIOManagerIsRunning checks whether a
      previous IO manager thread is alive before starting one.  In the child
      of fork(), we can hence call ensureIOManagerIsRunning to restart the
      IO manager.
      23939c64
  33. 30 Aug, 2009 1 commit
    • Simon Marlow's avatar
      Address #3310 · a5e2fa98
      Simon Marlow authored
       - Rename BlockedOnDeadMVar   -> BlockedIndefinitelyOnMVar
       - Rename BlockedIndefinitely -> BlockedIndefinitelyOnSTM
       - instance Show BlockedIndefinitelyOnMVar is now
           "blocked indefinitely in an MVar operation"
       - instance Show BlockedIndefinitelyOnSTM is now
           "blocked indefinitely in an STM transaction"
      
      clients using Control.OldException will be unaffected (the new
      exceptions are mapped to the old names).  However, for base4-compat
      we'll need to make a version of catch/try that does a similar
      mapping.
      a5e2fa98
  34. 07 Aug, 2009 1 commit
  35. 11 Jul, 2009 1 commit
  36. 10 Jul, 2009 4 commits