Boost logo

Boost :

From: Michael Glassford (glassfordm_at_[hidden])
Date: 2004-08-02 08:38:57


Aaron W. LaFramboise wrote:
> Michael Glassford wrote:
>
>>Aaron W. LaFramboise wrote:
>>
>>
>>>Following is an implementation of, and some comments on, a staticly
>>>linked Boost.Thread thread exit handler for MSVC.
>>>
>>>By the way, I appologize for talking so long to cough this up after
>>>posting teasing remarks about this months ago. Programming is presently
>>>a hobby and volunteer work for me, unfortunately.
>>
>>Thanks! I've been looking forward to you posting this, and it appears to
>>work beautifully for VC++ 7.1 (as others have already commented). Do I
>>have your permission to included it in Boost.Threads under the Boost
>>license (with your name on it, of course)?
>
>
> Yes, you and anyone else have perpetual permission to offer it under any
> license you choose.

Thank you. It's in, and will be in the upcoming release. A lot of people
will be happy, including me! I look forward to the GCC version as well,
though I haven't yet used GCC myself.

> I'm working on a way to do this under VC6. Please let me know if theres
> any other way I can be of assistance with regards to this.

By the way, in your posting, you had this code:

// Report thread and process detach events.
void NTAPI tls_callback (PVOID, DWORD Reason, PVOID) {

   if(Reason == DLL_THREAD_DETACH)
     on_thread_exit();
   else if(Reason == DLL_PROCESS_DETACH) {
     on_thread_exit();
     on_process_exit();
   }
}

If I understand what DLL_PROCESS_DETACH means (the thread is being
notified that it is being detached because the process is exiting), the
call to on_process_exit() is incorrect; on_process_exit() is meant to be
called when the process actually exits (it calls TlsFree()). The most
likely place to call it is at the end of main() or after the main thread
exits.

Mike


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