Fix autorelease pool warnings when running multithreaded on Mac OS X [Tim Lindner]

This commit is contained in:
R. Belmont 2011-07-18 22:37:20 +00:00
parent 44ad8a207f
commit 77e86084ab
2 changed files with 13 additions and 1 deletions

View File

@ -405,7 +405,7 @@ endif # Win32
#------------------------------------------------- #-------------------------------------------------
ifeq ($(BASE_TARGETOS),macosx) ifeq ($(BASE_TARGETOS),macosx)
#OSDCOREOBJS += $(SDLOBJ)/osxutils.o OSDCOREOBJS += $(SDLOBJ)/osxutils.o
ifndef MACOSX_USE_LIBSDL ifndef MACOSX_USE_LIBSDL
# Compile using framework (compile using libSDL is the exception) # Compile using framework (compile using libSDL is the exception)

View File

@ -30,6 +30,9 @@ int sdl_num_processors = 0;
#include "eminline.h" #include "eminline.h"
#if defined(SDLMAME_MACOSX)
#include "osxutils.h"
#endif
//============================================================ //============================================================
// DEBUGGING // DEBUGGING
@ -627,6 +630,10 @@ static void *worker_thread_entry(void *param)
work_thread_info *thread = (work_thread_info *)param; work_thread_info *thread = (work_thread_info *)param;
osd_work_queue *queue = thread->queue; osd_work_queue *queue = thread->queue;
#if defined(SDLMAME_MACOSX)
void *arp = NewAutoreleasePool();
#endif
// loop until we exit // loop until we exit
for ( ;; ) for ( ;; )
{ {
@ -678,6 +685,11 @@ static void *worker_thread_entry(void *param)
atomic_exchange32(&thread->active, FALSE); atomic_exchange32(&thread->active, FALSE);
atomic_decrement32(&queue->livethreads); atomic_decrement32(&queue->livethreads);
} }
#if defined(SDLMAME_MACOSX)
ReleaseAutoreleasePool(arp);
#endif
return NULL; return NULL;
} }