* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL]: Include time.h.
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL] (GC_stop_world):
Use nanosleep() instead of usleep() if CPPCHECK.
#include <signal.h>
#include <semaphore.h>
#include <errno.h>
+#include <time.h> /* for nanosleep() */
#include <unistd.h>
#include "atomic_ops.h"
}
wait_usecs = 0;
}
- usleep(WAIT_UNIT);
+
+# if defined(CPPCHECK) /* || _POSIX_C_SOURCE >= 199309L */
+ {
+ struct timespec ts;
+
+ ts.tv_sec = 0;
+ ts.tv_nsec = WAIT_UNIT * 1000;
+ (void)nanosleep(&ts, NULL);
+ }
+# else
+ usleep(WAIT_UNIT);
+# endif
wait_usecs += WAIT_UNIT;
}
}