mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Changed code to avoid a potential race condition during program termination.
--HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402865
This commit is contained in:
parent
d4d79c64de
commit
31a4736c76
@ -120,12 +120,11 @@ namespace dlib
|
||||
reg.m.lock();
|
||||
const thread_id_type id = get_thread_id();
|
||||
thread_id_type id_copy;
|
||||
unsigned long count = reg.reg.count(id);
|
||||
member_function_pointer<>::kernel_1a mfp;
|
||||
|
||||
// Remove all the member function pointers for this thread from the tree
|
||||
// and call them.
|
||||
for (unsigned long i = 0; i < count; ++i)
|
||||
while (reg.reg[id] != 0)
|
||||
{
|
||||
reg.reg.remove(id,id_copy,mfp);
|
||||
reg.m.unlock();
|
||||
|
Loading…
Reference in New Issue
Block a user