Added GetSystemTimeAsFileTime definition when it is absent in WinAPI. Made constants as enum so that they can be used in switch/case statements. Added Boost.Sync time_units and mutex for Windows.

[SVN r85779]
This commit is contained in:
Andrey Semashev
2013-09-18 21:25:36 +00:00
parent e1e8b05e02
commit 8590e40965
2 changed files with 31 additions and 15 deletions

View File

@ -47,11 +47,14 @@ namespace win32
using ::WaitForSingleObject;
using ::QueueUserAPC;
static const DWORD_ infinite = INFINITE;
static const DWORD_ wait_abandoned = WAIT_ABANDONED;
static const DWORD_ wait_object_0 = WAIT_OBJECT_0;
static const DWORD_ wait_timeout = WAIT_TIMEOUT;
static const DWORD_ wait_failed = WAIT_FAILED;
enum
{
infinite = INFINITE,
wait_abandoned = WAIT_ABANDONED,
wait_object_0 = WAIT_OBJECT_0,
wait_timeout = WAIT_TIMEOUT,
wait_failed = WAIT_FAILED
};
#else
extern "C" {
@ -123,11 +126,14 @@ extern "C" {
using ::SetEvent;
using ::ResetEvent;
static const DWORD_ infinite = (DWORD_)0xFFFFFFFF;
static const DWORD_ wait_abandoned = 0x00000080L;
static const DWORD_ wait_object_0 = 0x00000000L;
static const DWORD_ wait_timeout = 0x00000102L;
static const DWORD_ wait_failed = (DWORD_)0xFFFFFFFF;
enum
{
infinite = (DWORD_)0xFFFFFFFF,
wait_abandoned = 0x00000080L,
wait_object_0 = 0x00000000L,
wait_timeout = 0x00000102L,
wait_failed = (DWORD_)0xFFFFFFFF
};
# endif
}

View File

@ -23,7 +23,7 @@ namespace win32 {
typedef SYSTEMTIME SYSTEMTIME_;
typedef SYSTEMTIME* PSYSTEMTIME_;
#ifndef UNDER_CE // Windows CE does not define GetSystemTimeAsFileTime
#ifdef BOOST_HAS_GETSYSTEMTIMEASFILETIME // Windows CE does not define GetSystemTimeAsFileTime
using ::GetSystemTimeAsFileTime;
#endif
using ::FileTimeToLocalFileTime;
@ -49,22 +49,32 @@ extern "C" {
WORD_ wMilliseconds;
} SYSTEMTIME_, *PSYSTEMTIME_;
#ifndef UNDER_CE // Windows CE does not define GetSystemTimeAsFileTime
#ifdef BOOST_HAS_GETSYSTEMTIMEASFILETIME // Windows CE does not define GetSystemTimeAsFileTime
__declspec(dllimport) void WINAPI
GetSystemTimeAsFileTime(FILETIME_* lpFileTime);
#endif
__declspec(dllimport) int WINAPI
FileTimeToLocalFileTime(const FILETIME_* lpFileTime,
FileTimeToLocalFileTime(const FILETIME_* lpFileTime,
FILETIME_* lpLocalFileTime);
__declspec(dllimport) void WINAPI
GetSystemTime(SYSTEMTIME_* lpSystemTime);
__declspec(dllimport) int WINAPI
SystemTimeToFileTime(const SYSTEMTIME_* lpSystemTime,
SystemTimeToFileTime(const SYSTEMTIME_* lpSystemTime,
FILETIME_* lpFileTime);
__declspec(dllimport) unsigned long __stdcall
__declspec(dllimport) DWORD_ WINAPI
GetTickCount();
}
#endif
#ifndef BOOST_HAS_GETSYSTEMTIMEASFILETIME
inline void WINAPI GetSystemTimeAsFileTime(FILETIME_* lpFileTime)
{
SYSTEMTIME_ st;
GetSystemTime(&st);
SystemTimeToFileTime(&st, lpFileTime);
}
#endif
}
}
}