[thread] WINTHREADS patches

I know the codebase for Boost.Thread is in the process of being restructured and some parts are being rewritten, but since the new code won't be available for the 1.34 release, it would probably be good to patch some of the minor WINTHREADS issues in the current code. Most of these relate to inconsistent use of narrow vs. wide versions of the Win32 API functions. There are also a couple of other small patches specifically related to using Boost.Thread under WinCE (I encountered most of these issues while building the thread library for WinCE 5 under MSVC 8). - libs\thread\src\exceptions.cpp: system_message() explicitly calls FormatMessageA. On some platforms like WinCE, this function does not exist. I replaced this with a call to FormatMessage and some code to convert the result to a narrow string for BOOST_NO_ANSI_APIS builds. - libs\thread\src\mutex.inl: In init_TryEnterCriticalSection, the GetProcAddress call is passed "TryEnterCriticalSection". Passing it TEXT("TryEnterCriticalSection") instead allows this statement to compile correctly on wide character builds (and still work on narrow builds as well). In new_mutex, I replaced the ATL conversion macro with some Win32 code to do the conversion. - libs\thread\src\tss_hooks.cpp: WinCE headers do not define the TLS_OUT_OF_INDEXES constant. Instead TlsAlloc() just returns 0xFFFFFFFF when it fails. Added some code to define TLS_OUT_OF_INDEXES as 0xFFFFFFF if it is not present. - libs\thread\src\tss_dll.cpp: Inexplicably, WinCE defines DllMain as receiving a HANDLE for its first parameter unlike HINSTANCE that normal Win32 uses. I believe many of these items have been mentioned in previous discussions, but I thought they might have fallen out of memory before the patches actually made it into the code. If there were important reasons why the changes were not made before, forgive me for missing the details of those earlier discussions. Thanks, -Dave

Hi David, Unfortunately I did not recognize, that your patches even exist. Also WinCE currently is not in the list of compilers beeing regression tested. (Would be nice if someone figured this out.) Did you consider putting these patches into the source forge, so they cannot be forgotten? Mailing lists are not too good to keep them I think. Nevertheless I'll try to merge them in. Altough I likely will be able no sooner than the next weekend. Regards Roland

Roland Schwarz wrote:
Hi David,
Unfortunately I did not recognize, that your patches even exist.
Actually, I think many of the patches submitted were before you and Anthony had responsibility for the Boost.Thread library and they came from others like Ulrich Eckhardt, not me. So, don't worry, you were not overlooking anything that I had submitted or anything recent. =)
Nevertheless I'll try to merge them in. Altough I likely will be able no sooner than the next weekend.
Not a problem and I appreciate it. It is not a big hurry to get them in. I just wanted to put them back out there so they eventually got included. Thanks, -Dave
participants (2)
-
David Deakins
-
Roland Schwarz