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

View File

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