aboutsummaryrefslogtreecommitdiff
path: root/utils/telldus-core/patches/930-usleep.patch
blob: c716129f8538ae904e3a43826eab5d4f5a03460c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--- a/common/common.h
+++ b/common/common.h
@@ -25,15 +25,13 @@
 #ifdef _WINDOWS
 #include <fstream>  // NOLINT(readability/streams)
 #endif
+#include <chrono>
 #include <string>
+#include <thread>
 #include "common/Strings.h"
 
 inline void msleep( const int msec) {
-#ifdef _WINDOWS
-	Sleep(msec);
-#else
-	usleep(msec*1000);
-#endif
+	std::this_thread::sleep_for(std::chrono::milliseconds(msec));
 }
 
 inline void dlog(const char *fmt, ...) {
--- a/service/TellStick_libftdi.cpp
+++ b/service/TellStick_libftdi.cpp
@@ -8,7 +8,6 @@
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <list>
 #include <string>
 
@@ -231,7 +230,7 @@ int TellStick::send( const std::string &
 				return TELLSTICK_SUCCESS;
 			}
 		} else if(ret == 0) {  // No data available
-			usleep(100);
+			std::this_thread::sleep_for(std::chrono::microseconds(100));
 		} else {  // Error
 			Log::debug("Broken pipe on read");
 			return TELLSTICK_ERROR_BROKEN_PIPE;