
Roland wrote:
On Wed, 04 Aug 2004 08:51:35 -0400 Michael Glassford <glassfordm@hotmail.com> wrote:
Thanks, that did turn out to be the problem. It works fine, now, which is really good news.
Fine.
I am currently trying to unify both versions (7 and 6). This also seems to be necessary, because Aarons code while paving the way yet has some minor problems (also on vc7):
While it is very interesting, that it is not mainCRTStartup which is the very first function of the executable that receives control, it may be problematic in our case.
I disbelieve that the threading library is prepared to be the very first in town (not even the EXE's entry point has been called yet!) and so I think it is much safer to initalize everything after the runtime system is up, but before main.
Having experimented a bit and thought a bit, here's my take on how this could work: 1) Functions on_process_enter() and on_thread_enter() are unnecessary. 2) DllMain() and tls_callback() are needed only to call on_thread_exit(). 3) Function at_thread_exit() schedules a tss cleanup task that needs to be run for a thread that uses tss. The first time it is executed it also calls: atexit(on_process_exit); atexit(on_thread_exit); to schedule cleanup for the main thread before destructors of global objects are run and to schedule on_process_exit() (which calls TlsFree()). 4) In addition, to provide some cleanup support for compilers that don't yet have tls_callback() support, the thread class continues to call on_thread_exit() after the thread function exits for threads created by Boost.Threads. This should make unification of the VC++ 7.1 and 6 versions easier; the only difference would be the startup code needed to call on_tls_prepare(), I believe. Comments? Also, I was wondering: has anyone tried this on VC++ 7.0? Mike