[GHC] #1048: Add forkIO that starts in 'block' mode
GHC
trac at galois.com
Wed Dec 13 10:13:39 EST 2006
#1048: Add forkIO that starts in 'block' mode
--------------------------------+-------------------------------------------
Reporter: ChrisKuklewicz | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: libraries/base | Version: 6.6
Severity: normal | Keywords: concurrency
Difficulty: Easy (1 hr) | Testcase:
Architecture: Multiple | Os: Multiple
--------------------------------+-------------------------------------------
The current forkIO starts in 'unblock' mode and the spawned thread can
receive asynchronous exceptions (and die) before the passed (IO ()) action
can start to run.
Even if the user tried (forkIO (block io)) the new thread can be killed
before entering the scope of block.
Proposal: Add forkBlockedIO that spawns the new thread in a 'block' state.
Alternative: Add forkInheritIO that spawns the new thread in the same
block or unblock state as the parent thread is at the forkInheritIO call.
Thus (forkBlockedIO = block . forkInheritIO) and (forkIO = unblock .
forkInheritIO).
Work around: At the moment a fresh MVar can immediately be used by the
parent to wait until the child has signaled that it is executing withing
the scope of the block (or exception handler, etc).
This ought to also be extended to forkBlockedOS or forkInheritOS.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1048>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list