forked from enlightenment/efl
ecore: Add function to check we're the main loop thread
Rearrange the the order of startup to avoid triggering the thread checks in ecore_event_type_new(). Signed-off-by: Mike McCormack <mj.mccormack@samsung.com> SVN revision: 61040
This commit is contained in:
parent
95b6992006
commit
f7ec79e13e
|
@ -120,8 +120,8 @@ ecore_init(void)
|
||||||
if (_ecore_fps_debug) _ecore_fps_debug_init();
|
if (_ecore_fps_debug) _ecore_fps_debug_init();
|
||||||
_ecore_main_loop_init();
|
_ecore_main_loop_init();
|
||||||
_ecore_signal_init();
|
_ecore_signal_init();
|
||||||
_ecore_exe_init();
|
|
||||||
_ecore_thread_init();
|
_ecore_thread_init();
|
||||||
|
_ecore_exe_init();
|
||||||
_ecore_glib_init();
|
_ecore_glib_init();
|
||||||
_ecore_job_init();
|
_ecore_job_init();
|
||||||
_ecore_time_init();
|
_ecore_time_init();
|
||||||
|
|
|
@ -185,6 +185,9 @@ void _ecore_fps_debug_runtime_add(double t);
|
||||||
|
|
||||||
void _ecore_thread_init(void);
|
void _ecore_thread_init(void);
|
||||||
void _ecore_thread_shutdown(void);
|
void _ecore_thread_shutdown(void);
|
||||||
|
void _ecore_thread_assert_main_loop_thread(const char *function);
|
||||||
|
|
||||||
|
#define ECORE_MAIN_LOOP_ASSERT() _ecore_thread_assert_main_loop_thread(__FUNCTION__)
|
||||||
|
|
||||||
void _ecore_glib_init(void);
|
void _ecore_glib_init(void);
|
||||||
void _ecore_glib_shutdown(void);
|
void _ecore_glib_shutdown(void);
|
||||||
|
|
|
@ -764,6 +764,11 @@ _ecore_thread_worker_new(void)
|
||||||
void
|
void
|
||||||
_ecore_thread_init(void)
|
_ecore_thread_init(void)
|
||||||
{
|
{
|
||||||
|
#ifdef EFL_HAVE_THREADS
|
||||||
|
main_loop_thread = PHS();
|
||||||
|
have_main_loop_thread = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
_ecore_thread_count_max = eina_cpu_count();
|
_ecore_thread_count_max = eina_cpu_count();
|
||||||
if (_ecore_thread_count_max <= 0)
|
if (_ecore_thread_count_max <= 0)
|
||||||
_ecore_thread_count_max = 1;
|
_ecore_thread_count_max = 1;
|
||||||
|
@ -773,8 +778,6 @@ _ecore_thread_init(void)
|
||||||
|
|
||||||
#ifdef EFL_HAVE_THREADS
|
#ifdef EFL_HAVE_THREADS
|
||||||
del_handler = ecore_event_handler_add(ECORE_THREAD_PIPE_DEL, _ecore_thread_pipe_del, NULL);
|
del_handler = ecore_event_handler_add(ECORE_THREAD_PIPE_DEL, _ecore_thread_pipe_del, NULL);
|
||||||
main_loop_thread = PHS();
|
|
||||||
have_main_loop_thread = 1;
|
|
||||||
|
|
||||||
LKI(_ecore_pending_job_threads_mutex);
|
LKI(_ecore_pending_job_threads_mutex);
|
||||||
LRWKI(_ecore_thread_global_hash_lock);
|
LRWKI(_ecore_thread_global_hash_lock);
|
||||||
|
@ -842,6 +845,22 @@ _ecore_thread_shutdown(void)
|
||||||
_ecore_thread_pipe = NULL;
|
_ecore_thread_pipe = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_ecore_thread_assert_main_loop_thread(const char *function)
|
||||||
|
{
|
||||||
|
Eina_Bool good;
|
||||||
|
#ifdef EFL_HAVE_THREADS
|
||||||
|
good = (main_loop_thread == PHS());
|
||||||
|
#else
|
||||||
|
good = Eina_True;
|
||||||
|
#endif
|
||||||
|
if (!good)
|
||||||
|
{
|
||||||
|
EINA_LOG_CRIT("Call to %s from wrong thread!", function);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup Ecore_Group Ecore - Main Loop and Job Functions.
|
* @addtogroup Ecore_Group Ecore - Main Loop and Job Functions.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue