eo resolv call cache - make TLS with __thread, linker+compiler do it

this will now fix the call cache to be a tls data member and thus
threadsafe. this is the sanest way.
This commit is contained in:
Carsten Haitzler 2016-09-07 20:52:50 +09:00
parent 09f19c3c73
commit 4478654be1
1 changed files with 7 additions and 1 deletions

View File

@ -760,9 +760,15 @@ typedef struct _Efl_Object_Call_Cache
# define EFL_FUNC_COMMON_OP_FUNC(Name) ((const void *) #Name)
#endif
#ifdef _MSC_VER
# define EFL_FUNC_TLS __declspec(thread)
#else
# define EFL_FUNC_TLS __thread
#endif
// cache OP id, get real fct and object data then do the call
#define EFL_FUNC_COMMON_OP(Obj, Name, DefRet) \
static Efl_Object_Call_Cache ___cache; /* static 0 by default */ \
static EFL_FUNC_TLS Efl_Object_Call_Cache ___cache; /* static 0 by default */ \
Efl_Object_Op_Call_Data ___call; \
if (EINA_UNLIKELY((___cache.op == EFL_NOOP) || \
(___cache.generation != _efl_object_init_generation))) \