From 0f9b39df3fad800dd352d7df5c6f1c062edfb432 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 7 Oct 2013 17:41:43 +0000 Subject: [PATCH] Fixed WinAPI compilation. Ported timed mutex to waitable timer. Windows time points are now aligned with FILETIME to reduce conversion overhead when used with waitable timers. [SVN r86192] --- include/boost/detail/winapi/basic_types.hpp | 4 +- include/boost/detail/winapi/dll.hpp | 39 +++++++++++++------ .../boost/detail/winapi/synchronization.hpp | 2 + 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/include/boost/detail/winapi/basic_types.hpp b/include/boost/detail/winapi/basic_types.hpp index ec05a38..6692fe0 100644 --- a/include/boost/detail/winapi/basic_types.hpp +++ b/include/boost/detail/winapi/basic_types.hpp @@ -101,7 +101,7 @@ extern "C" { # ifdef _WIN64 #if defined(__CYGWIN__) typedef long INT_PTR_; - typedef unsigned long INT_PTR_; + typedef unsigned long UINT_PTR_; typedef long LONG_PTR_; typedef unsigned long ULONG_PTR_; #else @@ -112,7 +112,7 @@ extern "C" { #endif # else typedef int INT_PTR_; - typedef unsigned int INT_PTR_; + typedef unsigned int UINT_PTR_; typedef long LONG_PTR_; typedef unsigned long ULONG_PTR_; # endif diff --git a/include/boost/detail/winapi/dll.hpp b/include/boost/detail/winapi/dll.hpp index 832d1e6..fcefddf 100644 --- a/include/boost/detail/winapi/dll.hpp +++ b/include/boost/detail/winapi/dll.hpp @@ -27,26 +27,47 @@ namespace winapi typedef ::NEARPROC NEARPROC_; typedef ::PROC PROC_; - using ::LoadLibrary; +# ifdef BOOST_NO_ANSI_APIS + using ::LoadLibraryW; + using ::GetModuleHandleW; +# else + using ::LoadLibraryA; + using ::GetModuleHandleA; +# endif using ::FreeLibrary; using ::GetProcAddress; - using ::GetModuleHandleA; #else extern "C" { -#ifdef _WIN64 +# ifdef _WIN64 typedef INT_PTR (WINAPI *FARPROC_)(); typedef INT_PTR (WINAPI *NEARPROC_)(); typedef INT_PTR (WINAPI *PROC_)(); -#else +# else typedef int (WINAPI *FARPROC_)(); typedef int (WINAPI *NEARPROC_)(); typedef int (WINAPI *PROC_)(); -#endif // _WIN64 +# endif // _WIN64 +# ifdef BOOST_NO_ANSI_APIS __declspec(dllimport) HMODULE_ WINAPI - LoadLibrary( - LPCTSTR_ lpFileName + LoadLibraryW( + LPCWSTR_ lpFileName ); + __declspec(dllimport) HMODULE_ WINAPI + GetModuleHandleW( + LPCWSTR_ lpFileName + ); +# else + __declspec(dllimport) HMODULE_ WINAPI + LoadLibraryA( + LPCSTR_ lpFileName + ); + __declspec(dllimport) HMODULE_ WINAPI + GetModuleHandleA( + LPCSTR_ lpFileName + ); +# endif + __declspec(dllimport) BOOL_ WINAPI FreeLibrary( HMODULE_ hModule @@ -56,10 +77,6 @@ extern "C" { HMODULE_ hModule, LPCSTR_ lpProcName ); - __declspec(dllimport) HMODULE_ WINAPI - GetModuleHandleA( - LPCSTR_ lpFileName - ); } #endif } diff --git a/include/boost/detail/winapi/synchronization.hpp b/include/boost/detail/winapi/synchronization.hpp index 88911df..cee7a7b 100644 --- a/include/boost/detail/winapi/synchronization.hpp +++ b/include/boost/detail/winapi/synchronization.hpp @@ -147,6 +147,8 @@ const DWORD_ wait_failed = (DWORD_)0xFFFFFFFF; #endif // defined( BOOST_USE_WINDOWS_H ) +const DWORD_ max_non_infinite_wait = (DWORD_)0xFFFFFFFE; + BOOST_FORCEINLINE HANDLE_ create_anonymous_mutex(_SECURITY_ATTRIBUTES* lpAttributes, BOOL_ bInitialOwner) { #ifdef BOOST_NO_ANSI_APIS