xbmc/xbmc — comment on commit fc67f9f1f01626f94e011a0bc95e07c5da37bd0b
File:  line 0
By FernetMenta:

Here is some pseudocode. I don't see any need for additional locking. Do I miss anything?

```
ConditionVariable cv;
vector sharedThreads;

lock_shared() { CSingleLock l(sec); if (!sharedThreads.exists(CurrentThreadId()) sharedThreads.push(CurrentThreadId()); }
lock()
{
CSingleLock l(sec);
while (sharedThreads.size() > 0 && !(sharedThreads.size() == 1 && sharedThreads[0]==CurrentThreadId()))
cv.wait(l);
sec.lock();
}
unlock_shared()
{
CSingleLock l(sec);
sharedThreads.erase(CurrentThreadId);
if (sharedThreads.size() <= 1)
cv.notifyAll();
}
```