[cpp]T* ptr; ptr = new T(...); tbb::atomic
ptr_atomic; ptr_atomic = ptr; /* Past this point ptr should be pointing to the fully constructed instance of T. Right? */[/cpp]
[cpp]tbb::atomicThat would work. But the rest of the code uses plain pointers. I can only make the pointer to point to an instance of T.
ptr_atomic; ptr_atomic = new T(...); /* past this point ptr_atomic points to the fully constructed instance of T. We can signal all other threads that it is OK to use ptr_atomic. */[/cpp]
ptr_atomic; T* ptr; T t; *ptr_atomic = t; // vs *ptr = t; /* any performance difference? */[/cpp]