From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-07-19 10:41:46
Michael Glassford wrote:
> Peter Dimov wrote:
>> However did you consider the alternative design of
>> void at_thread_exit( void (*pf)() );
>> (along the lines of atexit).
> There was already an add_thread_exit() that did this; at_thread_exit
> a better name, so I've just checked in the changes to use it.
> Functions passed to at_thread_exit() are what get called by
> on_thread_exit(). The dll version of Boost.Threads on Win32 calls
> automatically when a thread exits; in static builds of Boost.Threads,
> the user is responsible for calling on_thread_exit(), though hopefully
> this will change in a future Boost.Threads release.
> Were you suggesting that at_thread_exit be publically exposed as a
> feature of Boost.Threads on all platforms?
I was suggesting that the DLL version of Boost.Threads should implement
at_thread_exit itself. In static builds, the user would be responsible for
implementing it (and we can provide a sample implementation in, say,
at_thread_exit.dll). This way you won't need the dummy is_tss_implemented
function; TSS use will automatically cause link errors.
On the other hand, the on_thread_exit callback approach allows us to invoke
it automatically from Boost.Threads-created threads.
One possibility would be to retain both at_thread_exit and on_thread_exit in
DLL builds, but define neither in static builds. But this will cause link
errors due to the missing on_thread_exit even in programs that don't use
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk