eina: fix eina_lock on windows.

SVN revision: 58893
This commit is contained in:
Cedric BAIL 2011-04-25 08:48:20 +00:00
parent d12e4f28d4
commit 6692daabc3
3 changed files with 9 additions and 9 deletions

View File

@ -22,7 +22,7 @@
#ifndef __USE_UNIX98 #ifndef __USE_UNIX98
# define __USE_UNIX98 # define __USE_UNIX98
# include <pthread.h> # include <pthread.h>
# undef __USE_UNIX98 # undef __USE_UNIX98
#else #else
# include <pthread.h> # include <pthread.h>
#endif #endif
@ -44,10 +44,10 @@ eina_lock_new(Eina_Lock *mutex)
if (pthread_mutexattr_init(&attr) != 0) if (pthread_mutexattr_init(&attr) != 0)
return EINA_FALSE; return EINA_FALSE;
#ifdef PTHREAD_MUTEX_RECURSIVE #ifdef PTHREAD_MUTEX_RECURSIVE
if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0) if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0)
return EINA_FALSE; return EINA_FALSE;
#endif #endif
if (pthread_mutex_init(mutex, &attr) != 0) if (pthread_mutex_init(mutex, &attr) != 0)
return EINA_FALSE; return EINA_FALSE;

View File

@ -23,7 +23,7 @@
typedef CRITICAL_SECTION Eina_Lock; typedef CRITICAL_SECTION Eina_Lock;
EAPI extern Eina_Bool _threads_activated; EAPI extern Eina_Bool _eina_threads_activated;
static inline Eina_Bool static inline Eina_Bool
eina_lock_new(Eina_Lock *mutex) eina_lock_new(Eina_Lock *mutex)
@ -42,7 +42,7 @@ eina_lock_free(Eina_Lock *mutex)
static inline Eina_Bool static inline Eina_Bool
eina_lock_take(Eina_Lock *mutex) eina_lock_take(Eina_Lock *mutex)
{ {
if (!_threads_activated) return EINA_FALSE; if (!_eina_threads_activated) return EINA_FALSE;
EnterCriticalSection(mutex); EnterCriticalSection(mutex);
@ -52,7 +52,7 @@ eina_lock_take(Eina_Lock *mutex)
static inline Eina_Bool static inline Eina_Bool
eina_lock_take_try(Eina_Lock *mutex) eina_lock_take_try(Eina_Lock *mutex)
{ {
if (!_threads_activated) return EINA_FALSE; if (!_eina_threads_activated) return EINA_FALSE;
return TryEnterCriticalSection(mutex) == 0 ? EINA_FALSE : EINA_TRUE; return TryEnterCriticalSection(mutex) == 0 ? EINA_FALSE : EINA_TRUE;
} }
@ -60,7 +60,7 @@ eina_lock_take_try(Eina_Lock *mutex)
static inline Eina_Bool static inline Eina_Bool
eina_lock_release(Eina_Lock *mutex) eina_lock_release(Eina_Lock *mutex)
{ {
if (!_threads_activated) return EINA_FALSE; if (!_eina_threads_activated) return EINA_FALSE;
LeaveCriticalSection(mutex); LeaveCriticalSection(mutex);

View File

@ -46,7 +46,7 @@ eina_lock_take(Eina_Lock *mutex)
{ {
DWORD res; DWORD res;
if (!_threads_activated) return EINA_FALSE; if (!_eina_threads_activated) return EINA_FALSE;
res = WaitForSingleObject(*mutex, INFINITE); res = WaitForSingleObject(*mutex, INFINITE);
if ((res == WAIT_ABANDONED) || (res == WAIT_FAILED)) if ((res == WAIT_ABANDONED) || (res == WAIT_FAILED))
@ -64,7 +64,7 @@ eina_lock_take_try(Eina_Lock *mutex)
static inline Eina_Bool static inline Eina_Bool
eina_lock_release(Eina_Lock *mutex) eina_lock_release(Eina_Lock *mutex)
{ {
if (!_threads_activated) return EINA_FALSE; if (!_eina_threads_activated) return EINA_FALSE;
return ReleaseMutex(*mutex); return ReleaseMutex(*mutex);
} }