|
Boost : |
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2003-06-28 22:29:02
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
> functor
> 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. 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.
-Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk