Lock around dictionary updates.