[Boost-bugs] [Boost C++ Libraries] #5830: mutex.inl: extraneous use of GetVersionEx

Subject: [Boost-bugs] [Boost C++ Libraries] #5830: mutex.inl: extraneous use of GetVersionEx
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-08-30 03:31:41


#5830: mutex.inl: extraneous use of GetVersionEx
------------------------------+---------------------------------------------
 Reporter: anonymous | Owner:
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: None
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------------------------
 Index: mutex.inl
 ===================================================================
 RCS file: /cvsroot/boost/boost/libs/thread/src/mutex.inl,v
 retrieving revision 1.9
 diff -r1.9 mutex.inl
 21,28c21,34
 < OSVERSIONINFO version_info = {sizeof(OSVERSIONINFO)};
 < ::GetVersionEx(&version_info);
 < if (version_info.dwPlatformId == VER_PLATFORM_WIN32_NT &&
 < version_info.dwMajorVersion >= 4)
 < {
 < if (HMODULE kernel_module =
 GetModuleHandle(TEXT("KERNEL32.DLL")))
 < g_TryEnterCriticalSection =
 reinterpret_cast<TryEnterCriticalSection_type>(GetProcAddress(kernel_module,
 TEXT("TryEnterCriticalSection")));
 < }
 ---
> // No need for this test since Boost is using
 GetModuleHandle/GetProcAddress.
> //OSVERSIONINFO version_info = {sizeof(OSVERSIONINFO)};
> //::GetVersionEx(&version_info);
> //if (version_info.dwPlatformId == VER_PLATFORM_WIN32_NT &&
> // version_info.dwMajorVersion >= 4)
> //{
> // if (HMODULE kernel_module =
 GetModuleHandle(TEXT("KERNEL32.DLL")))
> // g_TryEnterCriticalSection =
 reinterpret_cast<TryEnterCriticalSection_type>(GetProcAddress(kernel_module,
 TEXT("TryEnterCriticalSection")));
> //}
>
> // The GetModuleHandle function returns a handle to KERNEL32.DLL
 without incrementing its reference count
> if (HMODULE kernel_module = GetModuleHandle(TEXT("KERNEL32.DLL"))) {
> g_TryEnterCriticalSection =
 reinterpret_cast<TryEnterCriticalSection_type>(GetProcAddress(kernel_module,
 TEXT("TryEnterCriticalSection")));
> }

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5830>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC