1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-21 12:49:10 +00:00

Replace hsMutex with std::mutex

This commit is contained in:
2014-04-05 20:45:58 -07:00
parent 964256411e
commit 2947acb2c8
16 changed files with 166 additions and 342 deletions

View File

@ -90,12 +90,13 @@ hsError plSoundPreloader::Run()
while (fRunning)
{
fCritSect.Lock();
while (fBuffers.GetCount())
{
templist.Append(fBuffers.Pop());
std::lock_guard<std::mutex> lock(fCritSect);
while (fBuffers.GetCount())
{
templist.Append(fBuffers.Pop());
}
}
fCritSect.Unlock();
if (templist.GetCount() == 0)
{
@ -130,14 +131,15 @@ hsError plSoundPreloader::Run()
}
// we need to be sure that all buffers are removed from our load list when shutting this thread down or we will hang,
// since the sound buffer will wait to be destroyed until it is marked as loaded
fCritSect.Lock();
while (fBuffers.GetCount())
// since the sound buffer will wait to be destroyed until it is marked as loaded
{
plSoundBuffer* buf = fBuffers.Pop();
buf->SetLoaded(true);
std::lock_guard<std::mutex> lock(fCritSect);
while (fBuffers.GetCount())
{
plSoundBuffer* buf = fBuffers.Pop();
buf->SetLoaded(true);
}
}
fCritSect.Unlock();
return hsOK;
}