Do not join threads during process exit on Windows (#1738)

This commit is contained in:
Cheng 2025-03-25 22:33:08 +09:00 committed by GitHub
parent 022eabb734
commit eda7a7b43e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -56,8 +56,16 @@ namespace scheduler {
/** A singleton scheduler to manage devices, streams, and task execution. */
Scheduler& scheduler() {
// Leak the scheduler on Windows to avoid joining threads on exit, can be
// removed after Visual Studio fixes bug:
// https://developercommunity.visualstudio.com/t/1654756
#ifdef _WIN32
static Scheduler* scheduler = new Scheduler;
return *scheduler;
#else
static Scheduler scheduler;
return scheduler;
#endif
}
} // namespace scheduler