diff options
author | Srimanta Panda <srimanta.panda@stericsson.com> | 2011-10-13 10:17:16 +0200 |
---|---|---|
committer | Srimanta Panda <srimanta.panda@stericsson.com> | 2011-10-13 10:27:32 +0200 |
commit | 7b1ae2029ad33a38e1e718a33e2879325b389332 (patch) | |
tree | a86e4cb793dff0147649c5731b46981ac701fed5 /os_wrappers | |
parent | fac26f795cf96ec624a3a334ba9b78ea2d86811d (diff) |
Added Windows Support
RIFF will be supported for the Windows platform. It requires
libusb-win32 library to build it.
Diffstat (limited to 'os_wrappers')
-rw-r--r-- | os_wrappers/CriticalSection.h | 5 | ||||
-rw-r--r-- | os_wrappers/Event.cpp | 9 | ||||
-rw-r--r-- | os_wrappers/Utilities.h | 9 |
3 files changed, 19 insertions, 4 deletions
diff --git a/os_wrappers/CriticalSection.h b/os_wrappers/CriticalSection.h index f67f42a..7b64f90 100644 --- a/os_wrappers/CriticalSection.h +++ b/os_wrappers/CriticalSection.h @@ -17,7 +17,10 @@ #pragma once -#ifndef _WIN32 +#ifdef _WIN32 +#include <windows.h> +#include <process.h> +#else #include <pthread.h> #endif diff --git a/os_wrappers/Event.cpp b/os_wrappers/Event.cpp index 0390735..cbe5aa3 100644 --- a/os_wrappers/Event.cpp +++ b/os_wrappers/Event.cpp @@ -44,13 +44,16 @@ void Event::signal() #endif } -void Event::wait(unsigned long timeout __attribute__((unused))) -{ #ifdef _WIN32 +void Event::wait(unsigned long timeout) +{ WaitForSingleObject(semaphore_, timeout); +} #else +void Event::wait(unsigned long timeout __attribute__((unused))) +{ sem_wait(&semaphore_); -#endif } +#endif /* @} */ diff --git a/os_wrappers/Utilities.h b/os_wrappers/Utilities.h index ca7eac9..ff7463d 100644 --- a/os_wrappers/Utilities.h +++ b/os_wrappers/Utilities.h @@ -18,16 +18,25 @@ #pragma once #include <sstream> #include <string> +#ifdef _WIN32 +#include <windows.h> +#endif using namespace std; + class Utilities { public: + static void sleep(int ms) { +#ifndef _WIN32 timespec delay; delay.tv_sec = 0; delay.tv_nsec = ms * 1000000; nanosleep(&delay, 0); +#else + Sleep(ms); +#endif } template<typename T, typename F> |