On 21 August 2015 at 19:25, Jeffrey Walton wrote: > From the sounds of it, it sounds like its the same issue that used to > occur with the double-checked locking initialization pattern. See, for > example, http://preshing.com/20130930/double-checked-locking-is-fixed-in-cpp11/. Except that nothing is read outside the critical section guarded by the mutex. > If this is the case, then use a memory barrier to ensure the write > completes after setting the pointer to NULL. pthread_mutex_unlock should be a release operation and pthread_mutex_lock should be an acquire operation.