#1391: forkProcess() in Schedule.c with -threaded should initialize mutexes in
child process (POSIX)
-------------------------------+--------------------------------------------
Reporter: thorkilnaur | Owner:
Type: bug | Status: new
Priority: high | Milestone: 6.8
Component: Runtime System | Version: 6.7
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Os: MacOS X | Testcase: forkprocess01(ghci)
Architecture: powerpc |
-------------------------------+--------------------------------------------
Comment (by simonmar):
The POSIX spec doesn't say anything about initialising mutexes in the
child, as far as I can see. The most pertinent section is
`pthread_atfork`:
[http://www.opengroup.org/onlinepubs/009695399/functions/pthread_atfork.html]
So this requirement must be specific to GNU libc (or perhaps to MacOS?).
The GNU libc documentation no longer includes threading stuff, and the
link you supplied above doesn't work. The man page for pthread_atfork on
my system here just reproduces the POSIX text.
As far as I can see, there are only two mutexes that might be problematic:
sched_mutex and cap->lock for the single Capability (forkProcess isn't
supported when there are multiple capabilities). It might be worth just
holding these across the call to fork(), and releasing them in both the
child and parent (or perhaps, initialising them in the child). Thorkil:
could you try this?
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1391>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs