/* before they are expected to stop (unless */
/* they have stopped voluntarily). */
-#ifdef GC_OSF1_THREADS
+#if defined(GC_OSF1_THREADS) || defined(THREAD_SANITIZER)
STATIC GC_bool GC_retry_signals = TRUE;
#else
STATIC GC_bool GC_retry_signals = FALSE;
/* There is no data race between the suspend handler (storing */
/* stack_ptr) and GC_push_all_stacks (fetching stack_ptr) because */
/* GC_push_all_stacks is executed after GC_stop_world exits and the */
- /* latter runs sem_[try]wait repeatedly waiting for all the suspended */
+ /* latter runs sem_wait repeatedly waiting for all the suspended */
/* threads to call sem_post. Nonetheless, stack_ptr is stored (here) */
/* and fetched (by GC_push_all_stacks) using the atomic primitives to */
/* avoid the related TSan warning. */
GC_wait_for_reclaim();
# endif
- /* TODO: Support GC_retry_signals */
+ /* TODO: Support GC_retry_signals (not needed for TSan) */
switch (RAISE_SIGNAL(t, GC_sig_suspend)) {
/* ESRCH cannot happen as terminated threads are handled above. */
case 0:
for (i = 0; i < n_live_threads; i++) {
retry:
-# ifdef THREAD_SANITIZER
- /* sem_wait() hangs sometimes. */
- while ((code = sem_trywait(&GC_suspend_ack_sem)) != 0
- && errno == EAGAIN)
- usleep(100);
-# else
- code = sem_wait(&GC_suspend_ack_sem);
-# endif
+ code = sem_wait(&GC_suspend_ack_sem);
if (0 != code) {
/* On Linux, sem_wait is documented to always return zero. */
/* But the documentation appears to be incorrect. */