On Mon, 2 May 2011, Enlightenment SVN wrote:

> Log:
> formalise eina lock results to be equivalent to true/false with added
>  deadlock for try.
>
>
>
> Author:       raster
> Date:         2011-05-02 01:24:06 -0700 (Mon, 02 May 2011)
> New Revision: 59101
> Trac:         http://trac.enlightenment.org/e/changeset/59101
>
> Modified:
>  trunk/eina/src/include/eina_inline_lock_posix.x
>
> Modified: trunk/eina/src/include/eina_inline_lock_posix.x
> ===================================================================
> --- trunk/eina/src/include/eina_inline_lock_posix.x   2011-05-02 07:28:07 UTC 
> (rev 59100)
> +++ trunk/eina/src/include/eina_inline_lock_posix.x   2011-05-02 08:24:06 UTC 
> (rev 59101)
> @@ -51,6 +51,19 @@
> #endif
> };
>
> +#ifdef EINA_LOCK_DEBUG
> +# define EINA_LOCK_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, 0, { 0 }, 0, 0 }
> +#else
> +# define EINA_LOCK_INITIALIZER { PTHREAD_MUTEX_INITIALIZER }

please don't do that. There is no static definition on Windows. You are 
adding an API which can not be used on Windows

Vincent

> +#endif
> +
> +typedef enum
> +{
> +   EINA_LOCK_FAIL     = EINA_FALSE,
> +   EINA_LOCK_SUCCEED  = EINA_TRUE,
> +   EINA_LOCK_DEADLOCK
> +} Eina_Lock_Result;
> +
> EAPI extern Eina_Bool _eina_threads_activated;
>
> #ifdef EINA_HAVE_DEBUG_THREADS
> @@ -59,7 +72,7 @@
> EAPI extern int _eina_threads_debug;
> #endif
>
> -static inline Eina_Bool
> +static inline Eina_Lock_Result
> eina_lock_new(Eina_Lock *mutex)
> {
>    pthread_mutexattr_t attr;
> @@ -94,7 +107,7 @@
> #endif
> }
>
> -static inline Eina_Bool
> +static inline Eina_Lock_Result
> eina_lock_take(Eina_Lock *mutex)
> {
>    Eina_Bool ret;
> @@ -128,7 +141,7 @@
>    return ret;
> }
>
> -static inline Eina_Bool
> +static inline Eina_Lock_Result
> eina_lock_take_try(Eina_Lock *mutex)
> {
>    Eina_Bool ret = EINA_FALSE;
> @@ -139,7 +152,7 @@
>    else if (ok == EDEADLK)
>      {
>         printf("ERROR ERROR: DEADLOCK on lock %p\n", mutex);
> -        ret = 2; // magic
> +        ret = EINA_LOCK_DEADLOCK; // magic
>      }
> #ifdef EINA_LOCK_DEBUG
>    if (ret == EINA_TRUE)
> @@ -152,7 +165,7 @@
>    return ret;
> }
>
> -static inline Eina_Bool
> +static inline Eina_Lock_Result
> eina_lock_release(Eina_Lock *mutex)
> {
>    Eina_Bool ret;
>
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today.  Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> enlightenment-svn mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>
>

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to