From 8d1462b61416fef1bcd978529ab653da173d822f Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Tue, 7 Nov 2000 20:32:52 +0000
Subject: [PATCH] pthread_atfork: don't call critical section functions before
 initialization is done.

---
 scheduler/pthread.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scheduler/pthread.c b/scheduler/pthread.c
index d654525b78f..124432aa578 100644
--- a/scheduler/pthread.c
+++ b/scheduler/pthread.c
@@ -124,13 +124,13 @@ int __pthread_atfork(void (*prepare)(void),
 		     void (*parent)(void),
 		     void (*child)(void))
 {
-    EnterCriticalSection( &atfork_section );
+    if (SystemHeap) EnterCriticalSection( &atfork_section );
     assert( atfork_count < MAX_ATFORK );
     atfork_prepare[atfork_count] = prepare;
     atfork_parent[atfork_count] = parent;
     atfork_child[atfork_count] = child;
     atfork_count++;
-    LeaveCriticalSection( &atfork_section );
+    if (SystemHeap) LeaveCriticalSection( &atfork_section );
     return 0;
 }
 strong_alias(__pthread_atfork, pthread_atfork);
-- 
GitLab