From b5d7276113c4eaf0dfbb8d12c80c1111d47033cd Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Thu, 27 Sep 2007 09:13:31 +0000 Subject: [PATCH] also acquire/release task->lock across fork() further attempt to fix #1391 on MacOS --- rts/Schedule.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rts/Schedule.c b/rts/Schedule.c index 22e6120..dee6a55 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -2143,6 +2143,7 @@ forkProcess(HsStablePtr *entry // inconsistent state in the child. See also #1391. ACQUIRE_LOCK(&sched_mutex); ACQUIRE_LOCK(&cap->lock); + ACQUIRE_LOCK(&cap->running_task->lock); pid = fork(); @@ -2150,6 +2151,7 @@ forkProcess(HsStablePtr *entry RELEASE_LOCK(&sched_mutex); RELEASE_LOCK(&cap->lock); + RELEASE_LOCK(&cap->running_task->lock); // just return the pid rts_unlock(cap); @@ -2160,6 +2162,7 @@ forkProcess(HsStablePtr *entry #if defined(THREADED_RTS) initMutex(&sched_mutex); initMutex(&cap->lock); + initMutex(&cap->running_task->lock); #endif // Now, all OS threads except the thread that forked are -- 1.7.10.4