Apply u-ra's patch to speed up CriticalSection on systems that use POSIX-threads (that is, not windows).

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6242 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
j4ck.fr0st 2010-09-30 17:17:13 +00:00
parent 1450385a53
commit 2a64643fdc
1 changed files with 8 additions and 0 deletions

View File

@ -318,9 +318,13 @@ namespace Common
void CriticalSection::Enter() void CriticalSection::Enter()
{ {
#ifdef DEBUG
int ret = pthread_mutex_lock(&mutex); int ret = pthread_mutex_lock(&mutex);
if (ret) ERROR_LOG(COMMON, "%s: pthread_mutex_lock(%p) failed: %s\n", if (ret) ERROR_LOG(COMMON, "%s: pthread_mutex_lock(%p) failed: %s\n",
__FUNCTION__, &mutex, strerror(ret)); __FUNCTION__, &mutex, strerror(ret));
#else
pthread_mutex_lock(&mutex);
#endif
} }
@ -332,9 +336,13 @@ namespace Common
void CriticalSection::Leave() void CriticalSection::Leave()
{ {
#ifdef DEBUG
int ret = pthread_mutex_unlock(&mutex); int ret = pthread_mutex_unlock(&mutex);
if (ret) ERROR_LOG(COMMON, "%s: pthread_mutex_unlock(%p) failed: %s\n", if (ret) ERROR_LOG(COMMON, "%s: pthread_mutex_unlock(%p) failed: %s\n",
__FUNCTION__, &mutex, strerror(ret)); __FUNCTION__, &mutex, strerror(ret));
#else
pthread_mutex_unlock(&mutex);
#endif
} }