Commit a23468b9 authored by Davis King's avatar Davis King

Fixed a bug in the Windows implementation of the signaler object, which was found

by Isaac Peterson.  The bug caused the program to deadlock if signal() or
broadcast() was called at exactly the same time a wait_or_timeout() funciton timed
out.
parent 04360d7a
......@@ -150,6 +150,9 @@ namespace dlib
// broadcast().
value = false;
// signal that we are awake
ReleaseSemaphore(hCountSema,(LONG)1,NULL);
// get a lock on the mutex for the waiters variable
waiters_mutex.lock();
// mark that one less thread will be waiting on this signaler.
......@@ -161,10 +164,11 @@ namespace dlib
else
{
value = true;
}
// signal that we are awake
ReleaseSemaphore(hCountSema,(LONG)1,NULL);
}
// relock the associated mutex
m.lock();
......
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