From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2003-06-29 06:17:30
Howard Hinnant wrote:
> On Saturday, June 28, 2003, at 06:32 PM, Philippe A. Bouchard wrote:
>> Thanks... but is it possible to obtain the initial address of the
>> object portably, given the current thread object?
> To the best of my knowledge, no. As currently designed the thread
> constructor is not required to record (remember) the starting function.
> Such a requirement could impose constraints on the implementation that
> would prohibit desirable optimizations, so we should not add this
> without sufficient motivation.
What I was looking for was to gather information for each specific thread
about their heap usages. A thread oriented implementation would allow
synchronized information without using mutexes.
> Specifically, with the current
> interface it is possible to implement the thread(f) constructor such
> that it does not need to access the heap if the type of f is a simple
> function pointer. However, if the thread is required to store f, then
> I suspect such an optimization would no longer be practical.
> Just shooting from the hip, one might be able to build a
> hash_map<thread, function<void()> > (<cough> excuse me, that's
> unordered_map<thread, fucntion<void()> >) to achieve such functionality
> if desired. However, I haven't actually prototyped that idea, so I
> can't swear it would work at this point.
Ok, I see.
-- Philippe A. Bouchard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk