summaryrefslogtreecommitdiff
path: root/src/lib/eo/eo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/eo/eo.c')
-rw-r--r--src/lib/eo/eo.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index bc71108..ee72b74 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -378,6 +378,13 @@ _eo_call_stack_free(void *ptr)
378 free(stack); 378 free(stack);
379} 379}
380 380
381#ifdef HAVE_THREAD_SPECIFIER
382static __thread Eo_Call_Stack *_eo_thread_stack = NULL;
383
384#define _EO_CALL_STACK_GET() ((_eo_thread_stack) ? _eo_thread_stack : (_eo_thread_stack = _eo_call_stack_create()))
385
386#else
387
381static Eo_Call_Stack *main_loop_stack = NULL; 388static Eo_Call_Stack *main_loop_stack = NULL;
382 389
383#define _EO_CALL_STACK_GET() ((EINA_LIKELY(eina_main_loop_is())) ? main_loop_stack : _eo_call_stack_get_thread()) 390#define _EO_CALL_STACK_GET() ((EINA_LIKELY(eina_main_loop_is())) ? main_loop_stack : _eo_call_stack_get_thread())
@@ -385,9 +392,7 @@ static Eo_Call_Stack *main_loop_stack = NULL;
385static inline Eo_Call_Stack * 392static inline Eo_Call_Stack *
386_eo_call_stack_get_thread(void) 393_eo_call_stack_get_thread(void)
387{ 394{
388 Eo_Call_Stack *stack; 395 Eo_Call_Stack *stack = eina_tls_get(_eo_call_stack_key);
389
390 stack = eina_tls_get(_eo_call_stack_key);
391 396
392 if (stack) return stack; 397 if (stack) return stack;
393 398
@@ -396,6 +401,7 @@ _eo_call_stack_get_thread(void)
396 401
397 return stack; 402 return stack;
398} 403}
404#endif
399 405
400EAPI EINA_CONST void * 406EAPI EINA_CONST void *
401_eo_stack_get(void) 407_eo_stack_get(void)
@@ -1777,12 +1783,14 @@ eo_init(void)
1777 } 1783 }
1778 } 1784 }
1779 1785
1786#ifndef HAVE_THREAD_SPECIFIER
1780 main_loop_stack = _eo_call_stack_create(); 1787 main_loop_stack = _eo_call_stack_create();
1781 if (!main_loop_stack) 1788 if (!main_loop_stack)
1782 { 1789 {
1783 EINA_LOG_ERR("Could not alloc eo call stack."); 1790 EINA_LOG_ERR("Could not alloc eo call stack.");
1784 return EINA_FALSE; 1791 return EINA_FALSE;
1785 } 1792 }
1793#endif
1786 1794
1787 return EINA_TRUE; 1795 return EINA_TRUE;
1788} 1796}