Fix a race condition in SetAdditionalStackDepth