From: u (js_at_[hidden])
Date: 2003-11-12 08:54:58
On Tuesday 11 November 2003 13:46, Martin Wille (u) wrote:
> I think it is possible to implement a thread
> specific pointer based on the same idea. Such
> an implementation would only consume a few native
> tss keys (probably only one) and it would overcome
> the (possibly small) implementation defined limit on
> the number of thread specific storage objects.
my first approach was similar, but instead of using a vector of id's per
thread, I was thinking of using a static map. The key would be
std::pair< thread_id, tss* >, the value std::pair< cleanup, void* >. In other
words: one key per thread and object (tss* would be set to 'this'), the value
would be the cleanup function and a pthread_key replacement. This has the
disadvantage that at each rw-access a mutex has to be locked/unlocked (can't
tell how often this happens). But this could be optimized.
The map would have a thread limitation, but you wouldn't need more thread_ids
than you have threads.
These are only some thoughts, I'm not very familiar to Boost.Threads
> Would you be interested in having such an implementation for
> thread specific storage (which would have the same interface as
> boost::thread_specific_ptr) available in Boost.Thread?
> If there is interest, then I would rewrite the existing (Spirit
> specific) code to match the interface of thread_specific_ptr.
> (naming suggestions for that alternative tsp are welcome)
Yes, I would be very interested, as we can't even start our program.
> Jorge: FYI, this won't be available in Boost 1.31 or in Spirit 1.8.
But if you want, I can be beta-tester ;)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk