úÎ@Ž?'     XBas van Dijk <v.dijk.bas@gmail.com> , Roel van Dijk <vandijk.roel@gmail.com>LA result of a thread is either some exception that was thrown in the thread  and wasn'?t catched or the actual value that was returned by the thread. )Sparks off a new thread to run the given  computation and returns the F of the newly created thread paired with an IO computation that waits for the result of the thread. JThe new thread will be a lightweight thread; if you want to use a foreign ,library that uses thread-local storage, use  instead. GGHC note: the new thread inherits the blocked state of the parent (see ). Like 0, this sparks off a new thread to run the given  computation and returns the / of the newly created thread paired with an IO 5computation that waits for the result of the thread. Unlike ,  creates a bound# thread, which is necessary if you Kneed to call foreign (non-Haskell) libraries that make use of thread-local state, such as OpenGL (see Control.Concurrent). Using  instead of . makes no difference at all to the scheduling Obehaviour of the Haskell runtime system. It is a common misconception that you  need to use  instead of # to avoid blocking all the Haskell ,threads when making a foreign call; this isn'#t the case. To allow foreign calls Kto be made without blocking all the Haskell threads (with GHC), it is only necessary to use the  -threaded/ option when linking your program, and to make &sure the foreign import is not marked unsafe. Like 2, but lets you specify on which CPU the thread is created. Unlike a  thread, a thread created by  3will stay on the same CPU for its entire lifetime ( threads >can migrate between CPUs according to the scheduling policy). 9 is useful for overriding the scheduling policy when you 4know in advance how best to distribute the threads. The = argument specifies the CPU number; it is interpreted modulo numCapabilities6 (note that it actually specifies a capability number Crather than a CPU number, but to a first approximation the two are  equivalent). Like ?, but the child thread is created with asynchronous exceptions  unmasked (see Control.Exception.mask). +Internally used function which generalises ,  and  ? by parameterizing the function which does the actual forking. +Retrieve the actual value from the result. When the result is  the exception is thrown. XBas van Dijk <v.dijk.bas@gmail.com> , Roel van Dijk <vandijk.roel@gmail.com> A  ThreadGroup; can be understood as a counter which counts the number of Jthreads that were added to the group minus the ones that have terminated. More formally a  ThreadGroup has the following semantics:   initializes the counter to 0. * Forking a thread increments the counter. O When a forked thread terminates, whether normally or by raising an exception,  the counter is decremented.  0 yields a transaction that returns the counter.   ) blocks as long as the counter is not 0. "Create an empty group of threads. FYield a transaction that returns the number of running threads in the group. )Note that because this function yields a " computation, the returned number 7is guaranteed to be consistent inside the transaction. LConvenience function which blocks until all threads, that were added to the  group have terminated. Same as Control.Concurrent.Thread. but additionaly adds  the thread to the group. Same as Control.Concurrent.Thread. but additionaly adds  the thread to the group. Same as Control.Concurrent.Thread. but 6 additionaly adds the thread to the group. (GHC only) Same as Control.Concurrent.Thread. but 6 additionaly adds the thread to the group. (GHC only) +Internally used function which generalises  ,   and   ? by parameterizing the function which does the actual forking. "Strictly modify the contents of a . Strict function composition          threads-0.4.0.1Control.Concurrent.ThreadControl.Concurrent.Thread.GroupMaskResultforkIOforkOSforkOnIOforkIOUnmaskedresult ThreadGroupnew nrOfRunningwaitbaseGHC.IOmaskghc-prim GHC.TypesIO GHC.Conc.SyncThreadIdblockIntfork GHC.Exception SomeExceptionSTM modifyTVarTVar∘!