Rearrange ThreadedFrameSource::Entry to allow the use of wxMutexLocker

Originally committed to SVN as r4788.
This commit is contained in:
Thomas Goyne 2010-09-15 22:10:42 +00:00
parent d3fca38ee7
commit dca2bd43fe
1 changed files with 19 additions and 15 deletions

View File

@ -115,22 +115,26 @@ AegiVideoFrame const& ThreadedFrameSource::ProcFrame(int frameNum, double time,
void *ThreadedFrameSource::Entry() {
while (!TestDestroy() && run) {
jobMutex.Lock();
if (nextSubs.get()) {
wxMutexLocker locker(fileMutex);
subs = nextSubs;
singleFrame = -1;
}
if (nextTime == -1.) {
jobReady.Wait();
jobMutex.Unlock();
continue;
}
double time;
int frameNum;
{
wxMutexLocker jobLocker(jobMutex);
double time = nextTime;
int frameNum = nextFrame;
nextTime = -1.;
jobMutex.Unlock();
if (nextTime == -1.) {
jobReady.Wait();
continue;
}
if (nextSubs.get()) {
wxMutexLocker fileLocker(fileMutex);
subs = nextSubs;
singleFrame = -1;
}
time = nextTime;
frameNum = nextFrame;
nextTime = -1.;
}
try {
AegiVideoFrame const& frame = ProcFrame(frameNum, time);