199207 (3) [Avatar] Offline
#1
Hi,

In listing 6.11 - A Thread safe lookup table.
It states

Because the number of buckets is fixed, the get_bucket() function #7 can be called without any locking #8, #9, #10

This is fine, but how do we know the initialisation of the vector, and in particular the calls

buckets[i].reset(new bucket_type);

are visible to the other threads when calling #8, #9, #10.

Do you not need to lock the mutex to ensure a synchronization point?

Thanks

CE