Add forkIO that starts in 'block' mode
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.
Trac metadata
Trac field | Value |
---|---|
Version | 6.6 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Multiple |
Architecture | Multiple |