#ifndef __USE_UNIX98
# define __USE_UNIX98
# include <pthread.h>
-# undef __USE_UNIX98
+# undef __USE_UNIX98
#else
# include <pthread.h>
#endif
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;
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)
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);
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;
}
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);
{
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))
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);
}