Make ng spawning thread-safe.