change EINA_ARRAY_THREADSAFE_ITER_RETURN to EINA_ARRAY_THREADSAFE_ITER_ESCAPE to match forthcoming threadsafe list api

SVN revision: 50956
This commit is contained in:
Mike Blumenkrantz 2010-08-10 07:48:00 +00:00
parent f7e902d3e7
commit 5b4ec5bd35
2 changed files with 11 additions and 12 deletions

View File

@ -194,14 +194,14 @@ EAPI Eina_Accessor * eina_array_accessor_new(Eina_Array *array) EINA_
#ifdef EINA_RWLOCKS_ENABLED #ifdef EINA_RWLOCKS_ENABLED
/** /**
* @def EINA_ARRAY_THREADSAFE_ITER_RETURN * @def EINA_ARRAY_THREADSAFE_ITER_ESCAPE
* @brief Macro to perform a return while using EINA_ARRAY_THREADSAFE_ITER_NEXT * @brief Macro to break a loop while using EINA_ARRAY_THREADSAFE_ITER_NEXT
* *
* @param array The array being iterated over. * @param array The array being iterated over.
* @param retval The value to be returned * @param esc The code to "escape" the loop with
* *
* This macro should be used any time the user wishes to perform a return * This macro should be used any time the user wishes to leave break the loop
* statement while using EINA_ARRAY_THREADSAFE_ITER_RETURN to unlock any mutexes * while using EINA_ARRAY_THREADSAFE_ITER_NEXT. It will unlock any mutexes
* which may have been locked while iterating. Failure to use this will likely * which may have been locked while iterating. Failure to use this will likely
* result in a deadlock. * result in a deadlock.
* *
@ -222,25 +222,24 @@ EAPI Eina_Accessor * eina_array_accessor_new(Eina_Array *array) EINA_
* if (item) * if (item)
* free(item); * free(item);
* else * else
* EINA_ARRAY_THREADSAFE_ITER_RETURN(array, NULL); * EINA_ARRAY_THREADSAFE_ITER_ESCAPE(array, return NULL;);
* } * }
* ); * );
* @endcode * @endcode
*/ */
#define EINA_ARRAY_THREADSAFE_ITER_RETURN(array, retval) \ #define EINA_ARRAY_THREADSAFE_ITER_ESCAPE(array, esc...) \
do \ do \
{ \ { \
if (_eina_array_threadsafety) \ if (_eina_array_threadsafety) \
pthread_rwlock_unlock(&(array)->lock); \ pthread_rwlock_unlock(&(array)->lock); \
return (retval); \ esc \
} \ } \
while (0) while (0)
#else #else
#define EINA_ARRAY_THREADSAFE_ITER_RETURN(array, retval) \ #define EINA_ARRAY_THREADSAFE_ITER_ESCAPE(array, esc...) \
return (retval) esc
#endif #endif
#include "eina_inline_array.x" #include "eina_inline_array.x"

View File

@ -647,7 +647,7 @@ eina_module_find(Eina_Array *array, const char *module)
continue; continue;
if (!strncmp(module, file_m, len)) if (!strncmp(module, file_m, len))
EINA_ARRAY_THREADSAFE_ITER_RETURN(array, m); EINA_ARRAY_THREADSAFE_ITER_ESCAPE(array, return m;);
} }
); );