|
Boost Users : |
Subject: Re: [Boost-users] How can I have an object-specific and thread-specific pointer?
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-11-22 17:26:04
Le 19/11/11 13:45, Peter Dimov a écrit :
>
> You are right. There is no way to distinguish a stack-allocated Object
> from another stack-allocated Object created at the same address, so a
> map keyed by the object address can't work. Your other option may be
> unique per-object identifiers for use as keys, with ~Object somehow
> marking the identifier as invalid. But the "invalid identifier" set
> will soon grow out of hand and I'm not seeing a way to purge it. You
> could, perhaps, store a shared_ptr to a dummy identifier object and
> use the corresponding weak_ptr as a key, but I'm not sure that this is
> worth the trouble (and allocations) if stack use is rare.
>
Hi,
I don't see why the thread_specific_ptr could not store a key that will
be managed by the pthread_key_ functions. AM I missing something
evident; isn't it?
Best,
Vicente
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net