From: Ivan Maidanski Date: Thu, 18 May 2017 09:00:45 +0000 (+0300) Subject: Workaround 'waiting while holding lock' code defect in stop_world (Unix) X-Git-Tag: v8.0.0~737 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c4c3247df00b447ef2dfa4c013b492add037c23f;p=gc 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. --- 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;