Cocoa Port:
- Fix another freeze on app exit when running on OS X v10.5 Leopard.
This commit is contained in:
parent
782447e115
commit
d83b1a260c
|
@ -40,7 +40,6 @@ typedef struct
|
||||||
NSUInteger frameJumpTarget;
|
NSUInteger frameJumpTarget;
|
||||||
int framesToSkip;
|
int framesToSkip;
|
||||||
uint64_t timeBudgetMachAbsTime;
|
uint64_t timeBudgetMachAbsTime;
|
||||||
bool exitThread;
|
|
||||||
pthread_mutex_t mutexOutputList;
|
pthread_mutex_t mutexOutputList;
|
||||||
pthread_mutex_t mutexThreadExecute;
|
pthread_mutex_t mutexThreadExecute;
|
||||||
pthread_cond_t condThreadExecute;
|
pthread_cond_t condThreadExecute;
|
||||||
|
|
|
@ -189,7 +189,6 @@ volatile bool execute = true;
|
||||||
AbsoluteTime timeBudgetAbsTime = NanosecondsToAbsolute(*(Nanoseconds *)&timeBudgetNanoseconds);
|
AbsoluteTime timeBudgetAbsTime = NanosecondsToAbsolute(*(Nanoseconds *)&timeBudgetNanoseconds);
|
||||||
threadParam.timeBudgetMachAbsTime = *(uint64_t *)&timeBudgetAbsTime;
|
threadParam.timeBudgetMachAbsTime = *(uint64_t *)&timeBudgetAbsTime;
|
||||||
|
|
||||||
threadParam.exitThread = false;
|
|
||||||
pthread_mutex_init(&threadParam.mutexOutputList, NULL);
|
pthread_mutex_init(&threadParam.mutexOutputList, NULL);
|
||||||
pthread_mutex_init(&threadParam.mutexThreadExecute, NULL);
|
pthread_mutex_init(&threadParam.mutexThreadExecute, NULL);
|
||||||
pthread_cond_init(&threadParam.condThreadExecute, NULL);
|
pthread_cond_init(&threadParam.condThreadExecute, NULL);
|
||||||
|
@ -221,11 +220,7 @@ volatile bool execute = true;
|
||||||
[self setCdsFirmware:nil];
|
[self setCdsFirmware:nil];
|
||||||
[self setCdsGPU:nil];
|
[self setCdsGPU:nil];
|
||||||
|
|
||||||
pthread_mutex_lock(&threadParam.mutexThreadExecute);
|
pthread_cancel(coreThread);
|
||||||
threadParam.exitThread = true;
|
|
||||||
pthread_cond_signal(&threadParam.condThreadExecute);
|
|
||||||
pthread_mutex_unlock(&threadParam.mutexThreadExecute);
|
|
||||||
|
|
||||||
pthread_join(coreThread, NULL);
|
pthread_join(coreThread, NULL);
|
||||||
coreThread = NULL;
|
coreThread = NULL;
|
||||||
|
|
||||||
|
@ -1070,19 +1065,13 @@ static void* RunCoreThread(void *arg)
|
||||||
pthread_mutex_lock(¶m->mutexThreadExecute);
|
pthread_mutex_lock(¶m->mutexThreadExecute);
|
||||||
timeBudget = param->timeBudgetMachAbsTime;
|
timeBudget = param->timeBudgetMachAbsTime;
|
||||||
|
|
||||||
while (!(param->state != CORESTATE_PAUSE && execute && !param->exitThread))
|
while (!(param->state != CORESTATE_PAUSE && execute))
|
||||||
{
|
{
|
||||||
pthread_cond_wait(¶m->condThreadExecute, ¶m->mutexThreadExecute);
|
pthread_cond_wait(¶m->condThreadExecute, ¶m->mutexThreadExecute);
|
||||||
startTime = mach_absolute_time();
|
startTime = mach_absolute_time();
|
||||||
timeBudget = param->timeBudgetMachAbsTime;
|
timeBudget = param->timeBudgetMachAbsTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param->exitThread)
|
|
||||||
{
|
|
||||||
pthread_mutex_unlock(¶m->mutexThreadExecute);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (param->state != CORESTATE_FRAMEJUMP)
|
if (param->state != CORESTATE_FRAMEJUMP)
|
||||||
{
|
{
|
||||||
[(CocoaDSController *)param->cdsController flush];
|
[(CocoaDSController *)param->cdsController flush];
|
||||||
|
@ -1222,7 +1211,7 @@ static void* RunCoreThread(void *arg)
|
||||||
mach_wait_until(startTime + timeBudget);
|
mach_wait_until(startTime + timeBudget);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (!param->exitThread);
|
} while(true);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue