From: Ivan Maidanski Date: Tue, 6 Mar 2018 22:13:15 +0000 (+0300) Subject: Workaround Haiku pthread_join failure in subthreadcreate_test X-Git-Tag: v7.6.6~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1d9c1e437ba41bcfcb94489b4d12bbf8aaa9d056;p=gc Workaround Haiku pthread_join failure in subthreadcreate_test Issue #97 (bdwgc). The underlying pthread_join fails because of some bug in Haiku OS (as of hrev51798) when many threads are created in parallel. * tests/subthread_create.c [__HAIKU__]: Include errno.h. * tests/subthread_create.c [__HAIKU__] (main): If pthread_join returned value is ESRCH then just end the test normally (i.e. ignore the failure of pthread_join); add comment and TODO item. --- diff --git a/tests/subthread_create.c b/tests/subthread_create.c index e30eae53..e67b3b1d 100644 --- a/tests/subthread_create.c +++ b/tests/subthread_create.c @@ -24,6 +24,10 @@ # include #endif +#if defined(__HAIKU__) +# include +#endif + #include #include @@ -125,6 +129,12 @@ int main(void) err = pthread_join(th[i], &res); if (err) { fprintf(stderr, "Failed to join thread: %s\n", strerror(err)); +# if defined(__HAIKU__) + /* The error is just ignored (and the test is ended) to */ + /* workaround some bug in Haiku pthread_join. */ + /* TODO: The thread is not deleted from GC_threads. */ + if (ESRCH == err) break; +# endif exit(1); } # else