Boost logo

Boost :

From: Andrey Semashev (andysem_at_[hidden])
Date: 2008-03-01 11:37:05


Hi, I have a couple of questions about thread_specific_ptr in 1.35.

1. I can see that there is an ability to set up a logic of reclaiming
resources that thread_specific_ptr points to. Why is it limited (a) only
to a pointer to function and (b) can only be set up in
thread_specific_ptr's constructor? It might be better to provide
interface similar to shared_ptr in this way? BTW, I can see that
although the cleanup function is required to receive T* as its argument,
it is being passed void* in the run_custom_cleanup_function. Isn't an
explicit cast required here?

2. Why thread_specific_ptr isn't copyable? Why can't it share TLS keys
(or whatever it uses to find the thread-specific resource) in the
dynamically allocated cleanup object? I would expect
thread_specific_ptr, being a pointer as its name implies, to be copyable.


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