Adds some naive thread safety to scopes.