Equip any new threads with an NSAutoreleasePool.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6978 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2011-01-29 23:46:26 +00:00
parent 2e4fae2b80
commit 2de8742368
3 changed files with 10 additions and 32 deletions

View File

@ -18,6 +18,10 @@
#define USE_RVALUE_REFERENCES
#endif
#ifdef __APPLE__
#import <Foundation/NSAutoreleasePool.h>
#endif
#if defined(_WIN32)
// WIN32
@ -256,9 +260,14 @@ private:
template <typename F>
static THREAD_RETURN RunAndDelete(void* param)
{
#ifdef __APPLE__
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#endif
static_cast<F*>(param)->Run();
delete static_cast<F*>(param);
#ifdef __APPLE__
[pool release];
#endif
return 0;
}
};

View File

@ -20,10 +20,6 @@
#include <windows.h>
#endif
#ifdef __APPLE__
#import <Foundation/NSAutoreleasePool.h>
#endif
#include "Setup.h" // Common
#include "Atomic.h"
#include "Thread.h"
@ -250,10 +246,6 @@ void Stop() // - Hammertime!
void CpuThread()
{
#ifdef __APPLE__
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#endif
CPluginManager &Plugins = CPluginManager::GetInstance();
const SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
@ -292,9 +284,6 @@ void CpuThread()
cpuRunloopQuit.Set();
#ifdef __APPLE__
[pool release];
#endif
return;
}
@ -303,10 +292,6 @@ void CpuThread()
// Call browser: Init():g_EmuThread(). See the BootManager.cpp file description for a complete call schedule.
void EmuThread()
{
#ifdef __APPLE__
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#endif
Host_UpdateMainFrame(); // Disable any menus or buttons at boot
cpuRunloopQuit.Init();
@ -492,10 +477,6 @@ void EmuThread()
cpuRunloopQuit.Shutdown();
g_bStopping = false;
#ifdef __APPLE__
[pool release];
#endif
}
// Set or get the running state

View File

@ -28,10 +28,6 @@
#include "../WiimoteEmu/WiimoteHid.h"
#ifdef __APPLE__
#import <Foundation/NSAutoreleasePool.h>
#endif
unsigned int g_wiimote_sources[MAX_WIIMOTES];
namespace WiimoteReal
@ -308,10 +304,6 @@ void Wiimote::StartThread(Wiimote *wiimote)
void Wiimote::ThreadFunc()
{
#ifdef __APPLE__
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#endif
char thname[] = "Wiimote # Thread";
thname[8] = (char)('1' + index);
Common::SetCurrentThreadName(thname);
@ -335,10 +327,6 @@ void Wiimote::ThreadFunc()
}
Host_ConnectWiimote(index, false);
#ifdef __APPLE__
[pool release];
#endif
}
#ifndef _WIN32