|
Boost : |
From: Steven Watanabe (steven_at_[hidden])
Date: 2007-03-03 21:50:34
AMDG
Timmo Stange <ts <at> sepulchrum.com> writes:
>
> Given the relative "distance" between this initialization code and a
> possible access of either manager or invoker member in the vtable, I
> think the problem is of a rather academical nature. But the code is
> still not strictly correct from my understanding.
I'm afraid that it is a very real problem. In pseudo-code
if(!vtable_initialized) {
stored_vtable_initialized = true;
stored_vtable.vtable_type(f);
}
if(stored_vtable.assign_to(f, functor)) vtable = &stored_vtable;
else vtable = 0;
Even with a single CPU if the thread is
interrupted immidiately after the assignment
to stored_vtable_initialized, another thread
can reach stored_vtable.assign_to(f, functor)
before stored_vtable is initialized.
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk