Permalink
Browse files

[fixed] race condition within the CCriticalSection::exit() call.

  • Loading branch information...
1 parent bf4b090 commit 019acfa52ef1524c73315a459fc29c39e9c06404 Jim Carroll committed Jul 31, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 xbmc/threads/Lockables.h
View
@@ -73,7 +73,10 @@ namespace XbmcThreads
{
ret = count - 1; // The -1 is because we don't want
// to count the try_lock increment.
- while (count > 0) // This will also unlock the try_lock.
+ // We must NOT compare "count" in this loop since
+ // as soon as the last unlock is called another thread
+ // can modify it.
+ for (unsigned int i = 0; i <= ret; i++) // This will also unlock the try_lock.
unlock();
}

0 comments on commit 019acfa

Please sign in to comment.