On Sun, 24 Apr 2011, Cedric BAIL wrote:
On Sun, Apr 24, 2011 at 6:12 PM, Vincent Torri <[email protected]> wrote:
On Sun, 24 Apr 2011, Enlightenment SVN wrote:
Modified: trunk/eina/src/lib/eina_main.c
===================================================================
--- trunk/eina/src/lib/eina_main.c 2011-04-24 15:44:18 UTC (rev 58868)
+++ trunk/eina/src/lib/eina_main.c 2011-04-24 15:54:09 UTC (rev 58869)
@@ -22,10 +22,6 @@
#include <stdio.h>
-#ifdef EFL_HAVE_POSIX_THREADS
-# include <pthread.h>
-#endif
-
#ifdef EFL_HAVE_WIN32_THREADS
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
@@ -50,6 +46,7 @@
#include "eina_magic.h"
#include "eina_rectangle.h"
#include "eina_safety_checks.h"
+#include "eina_lock.h"
/*============================================================================*
* Local *
@@ -77,25 +74,9 @@
#endif
#define DBG(...) EINA_LOG_DOM_DBG(_eina_log_dom, __VA_ARGS__)
-Eina_Bool _threads_activated = EINA_FALSE;
+EAPI Eina_Bool _threads_activated = EINA_FALSE;
-#ifdef EFL_HAVE_THREADS
-# ifdef EFL_HAVE_POSIX_THREADS
-static pthread_mutex_t _mutex = PTHREAD_MUTEX_INITIALIZER;
-# define LOCK() if(_threads_activated) pthread_mutex_lock(&_mutex)
-# define UNLOCK() if(_threads_activated) pthread_mutex_unlock(&_mutex)
-# define UNLOCK_FORCE() pthread_mutex_unlock(&_mutex)
-# else /* EFL_HAVE_WIN32_THREADS */
-static HANDLE _mutex = NULL;
-# define LOCK() if(_threads_activated) WaitForSingleObject(_mutex, INFINITE)
-# define UNLOCK() if(_threads_activated) ReleaseMutex(_mutex)
-# define UNLOCK_FORCE() ReleaseMutex(_mutex)
-# endif
-#else
-# define LOCK() do {} while (0)
-# define UNLOCK() do {} while (0)
-# define UNLOCK_FORCE() do {} while (0)
-#endif
+static Eina_Lock _mutex;
/* place module init/shutdown functions here to avoid other modules
* calling them by mistake.
@@ -231,6 +212,8 @@
}
}
+ eina_lock_new(&_mutex);
you don't check the returned value ?
Nop, don't need to enfore a working mutex here.
but if threads are not availables, the value of mutex is undefined
Vincent
------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been
demonstrated beyond question. Learn why your peers are replacing JEE
containers with lightweight application servers - and what you can gain
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel