Browse Source

Tidy up some loops over the queue.

Darryl Pogue 13 years ago
parent
commit
88f594bc11
  1. 6
      Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp

6
Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp

@ -81,7 +81,7 @@ hsError plSoundPreloader::Run()
while (fRunning) while (fRunning)
{ {
fCritSect.Lock(); fCritSect.Lock();
for (int i = fBuffers.GetCount(); i > 0; i--) while (fBuffers.GetCount())
{ {
templist.Append(fBuffers.Pop()); templist.Append(fBuffers.Pop());
} }
@ -94,7 +94,7 @@ hsError plSoundPreloader::Run()
else else
{ {
plAudioFileReader *reader = nil; plAudioFileReader *reader = nil;
for (int i = templist.GetCount(); i > 0; i--) while (templist.GetCount())
{ {
plSoundBuffer* buf = templist.Pop(); plSoundBuffer* buf = templist.Pop();
@ -122,7 +122,7 @@ 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, // 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 // since the sound buffer will wait to be destroyed until it is marked as loaded
fCritSect.Lock(); fCritSect.Lock();
for (int i = fBuffers.GetCount(); i > 0; i--) while (fBuffers.GetCount())
{ {
plSoundBuffer* buf = fBuffers.Pop(); plSoundBuffer* buf = fBuffers.Pop();
buf->SetLoaded(true); buf->SetLoaded(true);

Loading…
Cancel
Save