
"William E. Kempf" wrote: [...]
How about moving this discussion to c.p.t.?
Well, just in case... <Forward Quoted>
Thanks... I currently can't access c.p.t. in any reasonable manner. I'm working to rectify this,
http://news.cis.dfn.de might help. ;-) but in the mean time, I appreciate the cross
post.
I'll wait a day or two and post a reply addressing some of your points
to comp.programming.threads. You might also want to keep an eye on the
discussion of "validity" of the following DCSI** pattern (not exposing
thread_specific_ptr::release() or thread_specific_ptr::reset() to the
clients... Butenhof believes that since <quote>You at least need to be
sure all threads are "done" with the current key and will never read it
again, because pthread_key_delete() cannot invalidate the key</quote>,
the clients ("individual threads") should <quote>confirm that
synchronization by clearing their value for the key</quote>).
class stuff { /* ... */ };
class thing {
public:
thing(/* ... */) : /* ... */ stuff_shared_ptr(0) /* ... */ { /*...*/ }
~thing() { /* ... */ delete stuff_shared_ptr; /* ... */ }
/* ... */
const stuff & stuff_instance();
/* ... */
private:
/* ... */
mutex stuff_mtx;
stuff * stuff_shared_ptr;
thread_specific_ptr