From: Ivan Maidanski Date: Tue, 6 Mar 2018 22:24:05 +0000 (+0300) Subject: Workaround sem_wait failure in pthread_create on Haiku X-Git-Tag: v7.6.6~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=47ca7611ee3a0946346728ccf0125f3682af9d63;p=gc Workaround sem_wait failure in pthread_create on Haiku Issue #97 (bdwgc). sem_wait() fails because of some bug in Haiku OS (as of hrev51798). * pthread_support.c [GC_HAIKU_THREADS] (WRAP_FUNC(pthread_create)): If errno is EACCES then just retry sem_wait instead of ABORT. --- diff --git a/pthread_support.c b/pthread_support.c index f0b8e929..969f477a 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -1876,6 +1876,10 @@ GC_API int WRAP_FUNC(pthread_create)(pthread_t *new_thread, DISABLE_CANCEL(cancel_state); /* pthread_create is not a cancellation point. */ while (0 != sem_wait(&(si -> registered))) { +# if defined(GC_HAIKU_THREADS) + /* To workaround some bug in Haiku semaphores. */ + if (EACCES == errno) continue; +# endif if (EINTR != errno) ABORT("sem_wait failed"); } RESTORE_CANCEL(cancel_state);