Boost logo

Boost :

From: Steven Watanabe (steven_at_[hidden])
Date: 2007-03-03 21:50:34


Timmo Stange <ts <at>> 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;
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, gregod at, cpdaniel at, john at