But should the array pointer itself also be atomic?
In general, it depends on how this pointer is used by different threads. If one thread can change it, if others read, then yes. In your case, no, you do not need it. Assuming your program is correct (otherwise the answer does not make sense), you cannot use an instance of your class until it is completely built, i.e. the constructor will finish.
Can another thread try to access the message after the constructor completes, only to find that the messages have not yet received a value?
It is your task to make this class inaccessible to multiple threads until it is fully initialized. After that, everything should be fine.
Slava source share