Boost logo

Boost :

From: David Deakins (ddeakins_at_[hidden])
Date: 2006-10-03 19:15:53


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







Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk