From 7f6e9074f4d332ead9aee1ab9ef72fe6efdc934e Mon Sep 17 00:00:00 2001 From: rogerman Date: Fri, 16 Mar 2012 04:21:28 +0000 Subject: [PATCH] Cocoa Port: - Fix potential deadlock on application exit. - Misc. code cleanup. --- desmume/src/cocoa/cocoa_core.mm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/desmume/src/cocoa/cocoa_core.mm b/desmume/src/cocoa/cocoa_core.mm index 3970ce2d2..613cc22f9 100644 --- a/desmume/src/cocoa/cocoa_core.mm +++ b/desmume/src/cocoa/cocoa_core.mm @@ -26,6 +26,7 @@ #include #include +#include "../addons.h" #include "../NDSSystem.h" #undef BOOL @@ -165,6 +166,8 @@ static BOOL isCoreStarted = NO; return isCoreStarted; } + addonsChangePak(NDS_ADDON_NONE); + result = NDS_Init(); if (result == -1) { @@ -665,6 +668,7 @@ static void* RunCoreThread(void *arg) if (param->exitThread) { + pthread_mutex_unlock(¶m->mutexThreadExecute); break; } @@ -716,10 +720,7 @@ static void* RunCoreThread(void *arg) pthread_mutex_unlock(¶m->mutexThreadExecute); // If there is any time left in the loop, go ahead and pad it. - if(timeBudget > (mach_absolute_time() - startTime)) - { - mach_wait_until(startTime + timeBudget); - } + mach_wait_until(startTime + timeBudget); } while (!param->exitThread);