Skip to content

Commit

Permalink
Workaround sem_wait failure in pthread_create on Haiku
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ivmai committed Apr 17, 2018
1 parent 1d9c1e4 commit 47ca761
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pthread_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 47ca761

Please sign in to comment.