mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Fix a crash on exit
In Thread::idle_loop() we now access main thread data, namely Threads.main()->thinking So upon exit we have to ensure main thread is the last one to be deleted. It can be easily reproduced setting more then one thread and then quitting. This bug happens also in original lazy_smp but for some reason remains hidden. Although a crash, this should not compromise TCEC version because it occurs only upon exiting the engine. No functional change.
This commit is contained in:
parent
dee1bd8ebc
commit
494aeb199d
1 changed files with 3 additions and 1 deletions
|
@ -190,8 +190,10 @@ void ThreadPool::exit() {
|
|||
timer = nullptr;
|
||||
|
||||
for (Thread* th : *this)
|
||||
delete_thread(th);
|
||||
if (th != Threads.main())
|
||||
delete_thread(th);
|
||||
|
||||
delete_thread(Threads.main()); // Must be the last one
|
||||
clear(); // Get rid of stale pointers
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue