mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 19:52:50 +08:00
Added platform independent sleep function
This commit is contained in:
@@ -4,6 +4,7 @@ set(support_source_files
|
|||||||
filesystem.cpp
|
filesystem.cpp
|
||||||
timing.cpp
|
timing.cpp
|
||||||
tinythread.cpp
|
tinythread.cpp
|
||||||
|
platform.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(support STATIC ${support_source_files})
|
add_library(support STATIC ${support_source_files})
|
||||||
|
10
src/openalpr/support/platform.cpp
Normal file
10
src/openalpr/support/platform.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
void sleep_ms(int sleepMs)
|
||||||
|
{
|
||||||
|
#ifdef WINDOWS
|
||||||
|
Sleep(sleepMs);
|
||||||
|
#else
|
||||||
|
usleep(sleepMs * 1000); // usleep takes sleep time in us (1 millionth of a second)
|
||||||
|
#endif
|
||||||
|
}
|
14
src/openalpr/support/platform.h
Normal file
14
src/openalpr/support/platform.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef OPENALPR_PLATFORM_H
|
||||||
|
#define OPENALPR_PLATFORM_H
|
||||||
|
|
||||||
|
#ifdef WINDOWS
|
||||||
|
#include <windows.h>
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void sleep_ms(int sleepMs);
|
||||||
|
|
||||||
|
|
||||||
|
#endif //OPENALPR_PLATFORM_H
|
Reference in New Issue
Block a user