Skip to content

Commit

Permalink
Merge pull request #460 from neheb/patch-1
Browse files Browse the repository at this point in the history
googletest: Switch to nanosleep
  • Loading branch information
sergiud authored Oct 31, 2019
2 parents 1655f4f + 1d762fa commit 6f5699a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/googletest.h
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,12 @@ class Thread {

static inline void SleepForMilliseconds(int t) {
#ifndef OS_WINDOWS
# if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309L
const struct timespec req = {0, t * 1000 * 1000};
nanosleep(&req, NULL);
# else
usleep(t * 1000);
# endif
#else
Sleep(t);
#endif
Expand Down

0 comments on commit 6f5699a

Please sign in to comment.