summaryrefslogtreecommitdiff
path: root/pthread_support.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2023-01-02 01:00:40 +0300
committerIvan Maidanski <ivmai@mail.ru>2023-01-02 01:00:40 +0300
commit04d7f70721be8098d0778e145f7af37cd74d7634 (patch)
tree0226a467c222aeeb4747c97d66f645fe66e78d73 /pthread_support.c
parentc934a428ccc1f58bc3c9f535408043b7fc20107d (diff)
downloadbdwgc-04d7f70721be8098d0778e145f7af37cd74d7634.tar.gz
Fix 'failed to create new win32 semaphore' Cygwin fatal error at fork
Issue #522 (bdwgc). The solution is to use semaphore operations emulation provided in darwin_semaphore.h. * include/private/darwin_semaphore.h [!GC_DARWIN_THREADS]: Preprocessor error only if not GC_WIN32_THREADS; update error message. * include/private/darwin_semaphore.h: Update comment. * include/private/gcconfig.h [CYGWIN32 && GC_WIN32_THREADS && CAN_HANDLE_FORK && !EMULATE_PTHREAD_SEMAPHORE && !CYGWIN_SEM_FIXUP_AFTER_FORK_BUG_FIXED] (EMULATE_PTHREAD_SEMAPHORE): * pthread_support.c [GC_PTHREADS && GC_WIN32_THREADS && EMULATE_PTHREAD_SEMAPHORE]: Include darwin_semaphore.h instead of semaphore.h.
Diffstat (limited to 'pthread_support.c')
-rw-r--r--pthread_support.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pthread_support.c b/pthread_support.c
index 27437bb0..b0f1a1bd 100644
--- a/pthread_support.c
+++ b/pthread_support.c
@@ -35,7 +35,8 @@
# ifndef GC_WIN32_PTHREADS
# include <unistd.h>
# endif
-# ifdef GC_DARWIN_THREADS
+# if defined(GC_DARWIN_THREADS) \
+ || (defined(GC_WIN32_THREADS) && defined(EMULATE_PTHREAD_SEMAPHORE))
# include "private/darwin_semaphore.h"
# elif !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2)
# include <semaphore.h>