Fix race condition on shutdown that could result in the program not completely exiting on Windows
Originally committed to SVN as r6729.
This commit is contained in:
parent
81d1073a97
commit
2deafdd3a7
1 changed files with 10 additions and 3 deletions
|
@ -131,13 +131,16 @@ std::tr1::shared_ptr<AegiVideoFrame> ThreadedFrameSource::ProcFrame(int frameNum
|
|||
}
|
||||
|
||||
void *ThreadedFrameSource::Entry() {
|
||||
while (!TestDestroy() && run) {
|
||||
while (!TestDestroy()) {
|
||||
double time;
|
||||
int frameNum;
|
||||
std::auto_ptr<AssFile> newSubs;
|
||||
{
|
||||
wxMutexLocker jobLocker(jobMutex);
|
||||
|
||||
if (!run)
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
if (nextTime == -1.) {
|
||||
jobReady.Wait();
|
||||
continue;
|
||||
|
@ -191,9 +194,13 @@ ThreadedFrameSource::ThreadedFrameSource(wxString videoFileName, wxEvtHandler *p
|
|||
Create();
|
||||
Run();
|
||||
}
|
||||
|
||||
ThreadedFrameSource::~ThreadedFrameSource() {
|
||||
run = false;
|
||||
jobReady.Signal();
|
||||
{
|
||||
wxMutexLocker locker(jobMutex);
|
||||
run = false;
|
||||
jobReady.Signal();
|
||||
}
|
||||
Wait();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue