From c4c3247df00b447ef2dfa4c013b492add037c23f Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 18 May 2017 12:00:45 +0300 Subject: [PATCH] Workaround 'waiting while holding lock' code defect in stop_world (Unix) * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && LINT2] (GC_stop_world): Redefine WAIT_UNIT to 1; call sched_yield() instead of usleep(); add comment. --- pthread_stop_world.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pthread_stop_world.c b/pthread_stop_world.c index 2be887b0..50f93d7f 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -772,7 +772,12 @@ GC_INNER void GC_stop_world(void) wait_usecs = 0; } -# if defined(CPPCHECK) /* || _POSIX_C_SOURCE >= 199309L */ +# ifdef LINT2 + /* Workaround "waiting while holding a lock" warning. */ +# undef WAIT_UNIT +# define WAIT_UNIT 1 + sched_yield(); +# elif defined(CPPCHECK) /* || _POSIX_C_SOURCE >= 199309L */ { struct timespec ts; -- 2.40.0