[OSX] Use spinlocks instead of mutexes since mutexes are really semaphores, gives me a decent speed up.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5420 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Sonicadvance1
2010-04-29 12:50:12 +00:00
parent 757285f7d0
commit 3103b920b6
2 changed files with 121 additions and 10 deletions

View File

@ -47,6 +47,10 @@
#error unsupported platform (no pthreads?)
#endif
#ifdef __APPLE__
#include <libkern/OSAtomic.h>
#endif
#endif
// Don't include common.h here as it will break LogManager
@ -75,7 +79,11 @@ class CriticalSection
CRITICAL_SECTION section;
#else
#ifdef _POSIX_THREADS
pthread_mutex_t mutex;
#ifdef __APPLE__
OSSpinLock lock;
#else
pthread_mutex_t mutex;
#endif
#endif
#endif
public:
@ -197,9 +205,14 @@ private:
bool is_set_;
#ifdef _POSIX_THREADS
#ifdef __APPLE__
OSSpinLock lock;
u32 event_;
#else
pthread_cond_t event_;
pthread_mutex_t mutex_;
#endif
#endif
#endif
};