]> 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>
Thu, 18 May 2017 09:00:45 +0000 (12:00 +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 2be887b05fae323395de6d2c882d5003114b2c51..50f93d7fc26a8e77e5542d1c91754920778c121d 100644 (file)
@@ -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;