@@ -54,10 +54,16 @@ # include <3ds/services/soc.h> #endif #if defined(OF_HAVE_THREADS) && (!defined(OF_AMIGAOS) || defined(OF_MORPHOS)) static OFMutex *mutex; + +static void +releaseMutex(void) +{ + [mutex release]; +} #endif #if !defined(OF_AMIGAOS) || defined(OF_MORPHOS) || !defined(OF_HAVE_THREADS) static bool initSuccessful = false; #endif @@ -123,10 +129,11 @@ atexit((void (*)(void))socExit); # endif # if defined(OF_HAVE_THREADS) && (!defined(OF_AMIGAOS) || defined(OF_MORPHOS)) mutex = [[OFMutex alloc] init]; + atexit(releaseMutex); # ifdef OF_WII if (of_spinlock_new(&spinlock) != 0) return; # endif @@ -144,12 +151,10 @@ # endif if (SocketBase != NULL) CloseLibrary(SocketBase); # endif - - [mutex release]; } #endif bool of_socket_init(void)