Make merging of PerThreadData into parent threadsafe