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:
Davis King 2009-02-05 03:09:58 +00:00
parent d4d79c64de
commit 31a4736c76
1 changed files with 1 additions and 2 deletions

View File

@ -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();