]> granicus.if.org Git - gc/commitdiff
Workaround 'waiting while holding lock' code defect in stop_world (Unix)
authorIvan Maidanski <ivmai@mail.ru>
Thu, 18 May 2017 09:00:45 +0000 (12:00 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 23 May 2017 22:28:55 +0000 (01:28 +0300)
* 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

index 72efbf0701c113872e2d298a6def9d78ca39e5ba..9fe65aecd03ce67ec016ce852bf19a073f0262c0 100644 (file)
@@ -771,7 +771,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;