[Scummvm-git-logs] scummvm master -> 128b20634fc03b924f129dfc940846192bf00813

criezy criezy at scummvm.org
Mon Nov 9 19:12:38 UTC 2020


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
832f5d1c4a IPHONE: Make use of ModularMutexBackend
0d4625d2d5 IOS7: Make use of ModularMutexBackend
128b20634f IOS7: Fix compilation with Xcode


Commit: 832f5d1c4abd6fbf84daf8c3e0e4cfd7accd3278
    https://github.com/scummvm/scummvm/commit/832f5d1c4abd6fbf84daf8c3e0e4cfd7accd3278
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2020-11-09T19:12:33Z

Commit Message:
IPHONE: Make use of ModularMutexBackend

Changed paths:
    backends/module.mk
    backends/platform/iphone/osys_main.cpp
    backends/platform/iphone/osys_main.h


diff --git a/backends/module.mk b/backends/module.mk
index b9550bfb1e..832a23100f 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -300,6 +300,11 @@ MODULE_OBJS += \
 	graphics/downscalesdl/downscalesdl-graphics.o
 endif
 
+ifeq ($(BACKEND),iphone)
+MODULE_OBJS += \
+	mutex/pthread/pthread-mutex.o
+endif
+
 ifeq ($(BACKEND),maemo)
 MODULE_OBJS += \
 	events/maemosdl/maemosdl-events.o \
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index 2361861548..a715769236 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -24,7 +24,6 @@
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
 
 #include <unistd.h>
-#include <pthread.h>
 
 #include <sys/time.h>
 
@@ -38,6 +37,7 @@
 
 #include "backends/saves/default/default-saves.h"
 #include "backends/timer/default/default-timer.h"
+#include "backends/mutex/pthread/pthread-mutex.h"
 #include "audio/mixer.h"
 #include "audio/mixer_intern.h"
 
@@ -84,6 +84,8 @@ int OSystem_IPHONE::timerHandler(int t) {
 }
 
 void OSystem_IPHONE::initBackend() {
+	_mutexManager = new PthreadMutexManager();
+
 #ifdef IPHONE_SANDBOXED
 	_savefileManager = new DefaultSaveFileManager(iPhone_getDocumentsDir());
 #else
@@ -181,41 +183,6 @@ void OSystem_IPHONE::delayMillis(uint msecs) {
 	usleep(msecs * 1000);
 }
 
-OSystem::MutexRef OSystem_IPHONE::createMutex(void) {
-	pthread_mutexattr_t attr;
-	pthread_mutexattr_init(&attr);
-	pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
-
-	pthread_mutex_t *mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t));
-	if (pthread_mutex_init(mutex, &attr) != 0) {
-		printf("pthread_mutex_init() failed!\n");
-		free(mutex);
-		return NULL;
-	}
-
-	return (MutexRef)mutex;
-}
-
-void OSystem_IPHONE::lockMutex(MutexRef mutex) {
-	if (pthread_mutex_lock((pthread_mutex_t *) mutex) != 0) {
-		printf("pthread_mutex_lock() failed!\n");
-	}
-}
-
-void OSystem_IPHONE::unlockMutex(MutexRef mutex) {
-	if (pthread_mutex_unlock((pthread_mutex_t *) mutex) != 0) {
-		printf("pthread_mutex_unlock() failed!\n");
-	}
-}
-
-void OSystem_IPHONE::deleteMutex(MutexRef mutex) {
-	if (pthread_mutex_destroy((pthread_mutex_t *) mutex) != 0) {
-		printf("pthread_mutex_destroy() failed!\n");
-	} else {
-		free(mutex);
-	}
-}
-
 
 void OSystem_IPHONE::setTimerCallback(TimerProc callback, int interval) {
 	//printf("setTimerCallback()\n");
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index f771d6e18e..1c0592439f 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -25,7 +25,7 @@
 
 #include "graphics/surface.h"
 #include "backends/platform/iphone/iphone_common.h"
-#include "backends/base-backend.h"
+#include "backends/modular-backend.h"
 #include "common/events.h"
 #include "audio/mixer_intern.h"
 #include "backends/fs/posix/posix-fs-factory.h"
@@ -52,7 +52,7 @@ struct AQCallbackStruct {
 	AudioStreamBasicDescription dataFormat;
 };
 
-class OSystem_IPHONE : public EventsBaseBackend, public PaletteManager {
+class OSystem_IPHONE : public EventsBaseBackend, public ModularMutexBackend, public PaletteManager {
 protected:
 	static AQCallbackStruct s_AudioQueue;
 	static SoundProc s_soundCallback;
@@ -167,11 +167,6 @@ public:
 	virtual uint32 getMillis(bool skipRecord = false);
 	virtual void delayMillis(uint msecs);
 
-	virtual MutexRef createMutex(void);
-	virtual void lockMutex(MutexRef mutex);
-	virtual void unlockMutex(MutexRef mutex);
-	virtual void deleteMutex(MutexRef mutex);
-
 	static void mixCallback(void *sys, byte *samples, int len);
 	virtual void setupMixer(void);
 	virtual void setTimerCallback(TimerProc callback, int interval);


Commit: 0d4625d2d51fa5ad0f74f97458ed1579f454f06a
    https://github.com/scummvm/scummvm/commit/0d4625d2d51fa5ad0f74f97458ed1579f454f06a
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2020-11-09T19:12:33Z

Commit Message:
IOS7: Make use of ModularMutexBackend

Changed paths:
    backends/module.mk
    backends/platform/ios7/ios7_osys_main.cpp
    backends/platform/ios7/ios7_osys_main.h


diff --git a/backends/module.mk b/backends/module.mk
index 832a23100f..09c55163f7 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -305,6 +305,11 @@ MODULE_OBJS += \
 	mutex/pthread/pthread-mutex.o
 endif
 
+ifeq ($(BACKEND),ios7)
+MODULE_OBJS += \
+	mutex/pthread/pthread-mutex.o
+endif
+
 ifeq ($(BACKEND),maemo)
 MODULE_OBJS += \
 	events/maemosdl/maemosdl-events.o \
diff --git a/backends/platform/ios7/ios7_osys_main.cpp b/backends/platform/ios7/ios7_osys_main.cpp
index 8cfd766918..02dad85f0d 100644
--- a/backends/platform/ios7/ios7_osys_main.cpp
+++ b/backends/platform/ios7/ios7_osys_main.cpp
@@ -24,7 +24,6 @@
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
 
 #include <unistd.h>
-#include <pthread.h>
 #include <string.h>
 
 #include <sys/time.h>
@@ -47,6 +46,7 @@
 
 #include "backends/saves/default/default-saves.h"
 #include "backends/timer/default/default-timer.h"
+#include "backends/mutex/pthread/pthread-mutex.h"
 #include "backends/fs/chroot/chroot-fs-factory.h"
 #include "backends/fs/posix/posix-fs.h"
 #include "audio/mixer.h"
@@ -157,6 +157,8 @@ int OSystem_iOS7::timerHandler(int t) {
 }
 
 void OSystem_iOS7::initBackend() {
+	_mutexManager = new PthreadMutexManager();
+
 #ifdef IPHONE_SANDBOXED
 	_savefileManager = new SandboxedSaveFileManager(_chrootBasePath, "/Savegames");
 #else
@@ -321,41 +323,6 @@ void OSystem_iOS7::delayMillis(uint msecs) {
 	usleep(msecs * 1000);
 }
 
-OSystem::MutexRef OSystem_iOS7::createMutex(void) {
-	pthread_mutexattr_t attr;
-	pthread_mutexattr_init(&attr);
-	pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
-
-	pthread_mutex_t *mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t));
-	if (pthread_mutex_init(mutex, &attr) != 0) {
-		printf("pthread_mutex_init() failed!\n");
-		free(mutex);
-		return NULL;
-	}
-
-	return (MutexRef)mutex;
-}
-
-void OSystem_iOS7::lockMutex(MutexRef mutex) {
-	if (pthread_mutex_lock((pthread_mutex_t *) mutex) != 0) {
-		printf("pthread_mutex_lock() failed!\n");
-	}
-}
-
-void OSystem_iOS7::unlockMutex(MutexRef mutex) {
-	if (pthread_mutex_unlock((pthread_mutex_t *) mutex) != 0) {
-		printf("pthread_mutex_unlock() failed!\n");
-	}
-}
-
-void OSystem_iOS7::deleteMutex(MutexRef mutex) {
-	if (pthread_mutex_destroy((pthread_mutex_t *) mutex) != 0) {
-		printf("pthread_mutex_destroy() failed!\n");
-	} else {
-		free(mutex);
-	}
-}
-
 
 void OSystem_iOS7::setTimerCallback(TimerProc callback, int interval) {
 	//printf("setTimerCallback()\n");
diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h
index 2139d5831c..71f12a4d56 100644
--- a/backends/platform/ios7/ios7_osys_main.h
+++ b/backends/platform/ios7/ios7_osys_main.h
@@ -25,7 +25,7 @@
 
 #include "graphics/surface.h"
 #include "backends/platform/ios7/ios7_common.h"
-#include "backends/base-backend.h"
+#include "backends/modular-backend.h"
 #include "common/events.h"
 #include "common/str.h"
 #include "common/ustr.h"
@@ -54,7 +54,7 @@ struct AQCallbackStruct {
 	AudioStreamBasicDescription dataFormat;
 };
 
-class OSystem_iOS7 : public EventsBaseBackend, public PaletteManager {
+class OSystem_iOS7 : public EventsBaseBackend, public ModularMutexBackend, public PaletteManager {
 protected:
 	static const OSystem::GraphicsMode s_supportedGraphicsModes[];
 	static AQCallbackStruct s_AudioQueue;
@@ -184,11 +184,6 @@ public:
 	virtual uint32 getMillis(bool skipRecord = false) override;
 	virtual void delayMillis(uint msecs) override;
 
-	virtual MutexRef createMutex(void) override;
-	virtual void lockMutex(MutexRef mutex) override;
-	virtual void unlockMutex(MutexRef mutex) override;
-	virtual void deleteMutex(MutexRef mutex) override;
-
 	static void mixCallback(void *sys, byte *samples, int len);
 	virtual void setupMixer(void);
 	virtual void setTimerCallback(TimerProc callback, int interval);


Commit: 128b20634fc03b924f129dfc940846192bf00813
    https://github.com/scummvm/scummvm/commit/128b20634fc03b924f129dfc940846192bf00813
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2020-11-09T19:12:33Z

Commit Message:
IOS7: Fix compilation with Xcode

Changed paths:
    backends/module.mk
    configure


diff --git a/backends/module.mk b/backends/module.mk
index 09c55163f7..c22c68ae6b 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -300,12 +300,7 @@ MODULE_OBJS += \
 	graphics/downscalesdl/downscalesdl-graphics.o
 endif
 
-ifeq ($(BACKEND),iphone)
-MODULE_OBJS += \
-	mutex/pthread/pthread-mutex.o
-endif
-
-ifeq ($(BACKEND),ios7)
+ifdef IPHONE
 MODULE_OBJS += \
 	mutex/pthread/pthread-mutex.o
 endif
diff --git a/configure b/configure
index 1b646b3309..825b8d4aff 100755
--- a/configure
+++ b/configure
@@ -3473,6 +3473,7 @@ if test -n "$_host"; then
 			_port_mk="backends/platform/gph/gp2xwiz-bundle.mk"
 			;;
 		iphone)
+			add_line_to_config_mk 'IPHONE = 1'
 			append_var DEFINES "-DIPHONE"
 			append_var ASFLAGS "-arch armv6"
 			_backend="iphone"
@@ -3482,6 +3483,7 @@ if test -n "$_host"; then
 			_timidity=no
 			;;
 		ios7)
+			add_line_to_config_mk 'IPHONE = 1'
 			append_var DEFINES "-DIPHONE -DIPHONE_IOS7 -DIPHONE_SANDBOXED"
 			_backend="ios7"
 			_seq_midi=no




More information about the Scummvm-git-logs mailing list