forked from enlightenment/efl
parent
d12e4f28d4
commit
6692daabc3
|
@ -22,7 +22,7 @@
|
|||
#ifndef __USE_UNIX98
|
||||
# define __USE_UNIX98
|
||||
# include <pthread.h>
|
||||
# undef __USE_UNIX98
|
||||
# undef __USE_UNIX98
|
||||
#else
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
|
@ -44,10 +44,10 @@ eina_lock_new(Eina_Lock *mutex)
|
|||
|
||||
if (pthread_mutexattr_init(&attr) != 0)
|
||||
return EINA_FALSE;
|
||||
#ifdef PTHREAD_MUTEX_RECURSIVE
|
||||
#ifdef PTHREAD_MUTEX_RECURSIVE
|
||||
if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0)
|
||||
return EINA_FALSE;
|
||||
#endif
|
||||
#endif
|
||||
if (pthread_mutex_init(mutex, &attr) != 0)
|
||||
return EINA_FALSE;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
typedef CRITICAL_SECTION Eina_Lock;
|
||||
|
||||
EAPI extern Eina_Bool _threads_activated;
|
||||
EAPI extern Eina_Bool _eina_threads_activated;
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_lock_new(Eina_Lock *mutex)
|
||||
|
@ -42,7 +42,7 @@ eina_lock_free(Eina_Lock *mutex)
|
|||
static inline Eina_Bool
|
||||
eina_lock_take(Eina_Lock *mutex)
|
||||
{
|
||||
if (!_threads_activated) return EINA_FALSE;
|
||||
if (!_eina_threads_activated) return EINA_FALSE;
|
||||
|
||||
EnterCriticalSection(mutex);
|
||||
|
||||
|
@ -52,7 +52,7 @@ eina_lock_take(Eina_Lock *mutex)
|
|||
static inline Eina_Bool
|
||||
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;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ eina_lock_take_try(Eina_Lock *mutex)
|
|||
static inline Eina_Bool
|
||||
eina_lock_release(Eina_Lock *mutex)
|
||||
{
|
||||
if (!_threads_activated) return EINA_FALSE;
|
||||
if (!_eina_threads_activated) return EINA_FALSE;
|
||||
|
||||
LeaveCriticalSection(mutex);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ eina_lock_take(Eina_Lock *mutex)
|
|||
{
|
||||
DWORD res;
|
||||
|
||||
if (!_threads_activated) return EINA_FALSE;
|
||||
if (!_eina_threads_activated) return EINA_FALSE;
|
||||
|
||||
res = WaitForSingleObject(*mutex, INFINITE);
|
||||
if ((res == WAIT_ABANDONED) || (res == WAIT_FAILED))
|
||||
|
@ -64,7 +64,7 @@ eina_lock_take_try(Eina_Lock *mutex)
|
|||
static inline Eina_Bool
|
||||
eina_lock_release(Eina_Lock *mutex)
|
||||
{
|
||||
if (!_threads_activated) return EINA_FALSE;
|
||||
if (!_eina_threads_activated) return EINA_FALSE;
|
||||
|
||||
return ReleaseMutex(*mutex);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue