Opened 11 years ago
Closed 11 years ago
#5830 closed Support Requests (invalid)
mutex.inl: extraneous use of GetVersionEx
Reported by: | anonymous | Owned by: | Anthony Williams |
---|---|---|---|
Milestone: | To Be Determined | Component: | thread |
Version: | Boost 1.47.0 | Severity: | Problem |
Keywords: | Cc: | noloader@… |
Description
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")));
}
Change History (6)
follow-up: 3 comment:1 by , 11 years ago
comment:2 by , 11 years ago
Cc: | added |
---|---|
Component: | None → thread |
Owner: | set to |
comment:3 by , 11 years ago
Replying to noloader@…:
Sorry about the poor formatting. It looks like the web submission system is cooking the copy/paste from the diff command.
Please use the code block. 5th widget from the left. E.g.
{ code block }
comment:4 by , 11 years ago
Type: | Bugs → Support Requests |
---|
Moved to support request until the format is clear.
comment:5 by , 11 years ago
Sorry, I don't see any file libs/thread/src/mutex.inl. Moved to support request until concerned file clarified.
comment:6 by , 11 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Closed as it seems these doesn't corresponds to the current Boost.Thread implementation.
Sorry about the poor formatting. It looks like the web submission system is cooking the copy/paste from the diff command.