tread_pool: create it on the heap, because creating it static generate a DTOR issue on mingw.
When built with mingw, the tread_pool DTOR is probably called too late, and treads are not cleaned correctly, and the application hangs on exit.
This commit is contained in:
@@ -24,10 +24,14 @@
|
||||
|
||||
#include <thread_pool.h>
|
||||
|
||||
// Under mingw, there is a problem with the destructor when creating a static instance
|
||||
// of a thread_pool: probably the DTOR is called too late, and the application hangs.
|
||||
// so we create it on the heap.
|
||||
static thread_pool* tp = nullptr;
|
||||
|
||||
thread_pool& GetKiCadThreadPool()
|
||||
{
|
||||
static thread_pool tp;
|
||||
return tp;
|
||||
}
|
||||
if( !tp ) tp = new thread_pool;
|
||||
|
||||
return *tp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user