Adds pthread locks