Commit cedccc9f authored by Davis King's avatar Davis King

Made global thread pool shutdown not attempted unless the thread pool was

already enabled.  This also makes the global destruction order a little more
deterministic.
parent cb9cb4e0
......@@ -39,15 +39,6 @@ namespace dlib
bool thread_pool_has_been_destroyed = false;
// ----------------------------------------------------------------------------------------
threader& thread_pool (
)
{
static threader* thread_pool = new threader;
return *thread_pool;
}
// ----------------------------------------------------------------------------------------
struct threader_destruct_helper
......@@ -59,7 +50,16 @@ namespace dlib
thread_pool().destruct_if_ready();
}
};
// ----------------------------------------------------------------------------------------
threader& thread_pool (
)
{
static threader* thread_pool = new threader;
static threader_destruct_helper a;
return *thread_pool;
}
// ----------------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment