libglog: Replace deprecated usleep with nanosleep
Optionally fixes compilation with uClibc-ng. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
85fab04196
commit
1432866818
|
@ -0,0 +1,24 @@
|
|||
From d7b02b6929baf5b21ee6e15a700b4fc82d962e9c Mon Sep 17 00:00:00 2001
|
||||
From: Rosen Penev <rosenp@gmail.com>
|
||||
Date: Thu, 25 Jul 2019 19:14:42 -0700
|
||||
Subject: [PATCH] googletest: Switch to nanosleep
|
||||
|
||||
usleep is deprecated and optionally not available with uClibc-ng.
|
||||
---
|
||||
src/googletest.h | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/googletest.h b/src/googletest.h
|
||||
index 49ddbc0a..39fb29fb 100644
|
||||
--- a/src/googletest.h
|
||||
+++ b/src/googletest.h
|
||||
@@ -574,7 +574,8 @@ class Thread {
|
||||
|
||||
static inline void SleepForMilliseconds(int t) {
|
||||
#ifndef OS_WINDOWS
|
||||
- usleep(t * 1000);
|
||||
+ const struct timespec req = {0, t * 1000 * 1000};
|
||||
+ nanosleep(&req, NULL);
|
||||
#else
|
||||
Sleep(t);
|
||||
#endif
|
Loading…
Reference in New Issue