Proposal: add forkOnIO and friends to Control.Concurrent:

Simon Marlow marlowsd at gmail.com
Wed Mar 30 13:50:41 CEST 2011


On 22/12/2010 11:41, Simon Marlow wrote:
 > Ticket:
 >
 > http://hackage.haskell.org/trac/ghc/ticket/4859
 >

FYI, I just pushed the following:

Wed Mar 30 03:05:04 PDT 2011  Simon Marlow <marlowsd at gmail.com>
   * Export the affinity API from Control.Concurrent: forkOn and friends.

   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.


Cheers,
	Simon



More information about the Libraries mailing list