From 3d78a3cb97ed470f331c5cdf7a3f3b2714a92f78 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 20 Jul 2015 13:18:06 +0200 Subject: plug in race in camera release We can crash if start/stop pressed fast eventually. --- opentrack/sleep.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 opentrack/sleep.hpp (limited to 'opentrack/sleep.hpp') diff --git a/opentrack/sleep.hpp b/opentrack/sleep.hpp new file mode 100644 index 00000000..27920842 --- /dev/null +++ b/opentrack/sleep.hpp @@ -0,0 +1,22 @@ +#pragma once + +namespace portable +{ +#ifdef _WIN32 + #include + + template + void sleep(unsigned milliseconds) + { + Sleep(milliseconds); + } +#else + #include + + template + void sleep(unsigned milliseconds) + { + usleep(milliseconds * 1000U); // takes microseconds + } +#endif +} -- cgit v1.2.3