Boost logo

Boost :

From: Scott McCaskill (scott_at_[hidden])
Date: 2001-07-31 17:33:50


> No, for all threads. Imagine the following:
>
> thread& thrd = thread::self();
> // actual thread finishes between these instructions
> if (thrd == thread::self())
> ...
>
> The comparison instruction produces undefined behavior since thrd
> references an object that's no longer in existence.
>

Perhaps this is just me being dense, but.. if thrd is on the stack, I cannot
see what the problem is here. In that case, the if statement will always be
true because each thread has its own stack. If it's not on the stack, then
there's a potential programming error. Is the goal to make it impossible to
make such an error?


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