Boost logo

Boost :

From: William Kempf (williamkempf_at_[hidden])
Date: 2001-09-06 16:31:53

From: "Peter Dimov" <pdimov_at_[hidden]>
>The on_thread_exit service exposed by threadmon.dll is very useful on its
>own (for win32 developers.) Perhaps it deserves to be documented?

It's an implementation detail and should not be used directly. What I have
considered was adding a boost::thread::atexit() method. I'm reluctant to
add to the interface during this review, but if it's considered important
enough I'll do this.

>I suggest the following improvement: change
>void on_thread_exit(void (*) ());
>void on_thread_exit(void (*) (void *), void *);
>(rationale: when on_thread_exit is called to register a function for the
>main thread, by the time the function is invoked, all thread-specific
>variables are already gone.)

I don't follow this. The thread_specific_ptr<> already handles cleanup of
thread-specific data and so boost::thread::atexit() would not be needed for
cleanup of this type. Passing a pointer to thread-specific data to atexit()
is going to result in an error since the data will have already been
reclaimed. I personally think that boost::thread::atexit() should use the
same syntax as std::atexit(). That's why I coded on_thread_exit() that way.

Bill Kempf

Get your FREE download of MSN Explorer at

Boost list run by bdawes at, gregod at, cpdaniel at, john at