forked from enlightenment/efl
ecore: Add basic thread checks
Signed-off-by: Mike McCormack <mj.mccormack@samsung.com> SVN revision: 61041
This commit is contained in:
parent
f7ec79e13e
commit
7b1d7bd4a0
|
@ -166,6 +166,8 @@ ecore_animator_add(Ecore_Task_Cb func, const void *data)
|
|||
{
|
||||
Ecore_Animator *animator;
|
||||
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!func) return NULL;
|
||||
animator = calloc(1, sizeof(Ecore_Animator));
|
||||
if (!animator) return NULL;
|
||||
|
@ -204,6 +206,8 @@ ecore_animator_timeline_add(double runtime, Ecore_Timeline_Cb func, const void *
|
|||
{
|
||||
Ecore_Animator *animator;
|
||||
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (runtime <= 0.0) runtime = 0.0;
|
||||
animator = ecore_animator_add(_ecore_animator_run, NULL);
|
||||
animator->data = animator;
|
||||
|
@ -358,6 +362,8 @@ ecore_animator_pos_map(double pos, Ecore_Pos_Map map, double v1, double v2)
|
|||
EAPI void *
|
||||
ecore_animator_del(Ecore_Animator *animator)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(animator, ECORE_MAGIC_ANIMATOR))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(animator, ECORE_MAGIC_ANIMATOR,
|
||||
|
@ -380,6 +386,8 @@ ecore_animator_del(Ecore_Animator *animator)
|
|||
EAPI void
|
||||
ecore_animator_frametime_set(double frametime)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (frametime < 0.0) frametime = 0.0;
|
||||
if (animators_frametime == frametime) return;
|
||||
animators_frametime = frametime;
|
||||
|
@ -409,6 +417,8 @@ ecore_animator_frametime_get(void)
|
|||
EAPI void
|
||||
ecore_animator_freeze(Ecore_Animator *animator)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(animator, ECORE_MAGIC_ANIMATOR))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(animator, ECORE_MAGIC_ANIMATOR,
|
||||
|
@ -429,6 +439,8 @@ ecore_animator_freeze(Ecore_Animator *animator)
|
|||
EAPI void
|
||||
ecore_animator_thaw(Ecore_Animator *animator)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(animator, ECORE_MAGIC_ANIMATOR))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(animator, ECORE_MAGIC_ANIMATOR,
|
||||
|
@ -463,6 +475,8 @@ ecore_animator_thaw(Ecore_Animator *animator)
|
|||
EAPI void
|
||||
ecore_animator_source_set(Ecore_Animator_Source source)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
src = source;
|
||||
_end_tick();
|
||||
if (animators) _begin_tick();
|
||||
|
@ -478,6 +492,8 @@ ecore_animator_source_set(Ecore_Animator_Source source)
|
|||
EAPI Ecore_Animator_Source
|
||||
ecore_animator_source_get(void)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
return src;
|
||||
}
|
||||
|
||||
|
@ -499,6 +515,8 @@ ecore_animator_source_get(void)
|
|||
EAPI void
|
||||
ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func, const void *data)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
begin_tick_cb = func;
|
||||
begin_tick_data = data;
|
||||
_end_tick();
|
||||
|
@ -519,6 +537,8 @@ ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func, const void *
|
|||
EAPI void
|
||||
ecore_animator_custom_source_tick_end_callback_set(Ecore_Cb func, const void *data)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
end_tick_cb = func;
|
||||
end_tick_data = data;
|
||||
_end_tick();
|
||||
|
@ -537,6 +557,8 @@ ecore_animator_custom_source_tick_end_callback_set(Ecore_Cb func, const void *da
|
|||
EAPI void
|
||||
ecore_animator_custom_tick(void)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (src == ECORE_ANIMATOR_SOURCE_CUSTOM) _do_tick();
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ static char **app_argv = NULL;
|
|||
EAPI void
|
||||
ecore_app_args_set(int argc, const char **argv)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if ((argc < 1) ||
|
||||
(!argv)) return;
|
||||
app_argc = argc;
|
||||
|
@ -63,6 +65,8 @@ ecore_app_args_set(int argc, const char **argv)
|
|||
EAPI void
|
||||
ecore_app_args_get(int *argc, char ***argv)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (argc) *argc = app_argc;
|
||||
if (argv) *argv = app_argv;
|
||||
}
|
||||
|
|
|
@ -142,6 +142,8 @@ ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, const void *data)
|
|||
{
|
||||
Ecore_Event_Handler *eh;
|
||||
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!func) return NULL;
|
||||
if ((type <= ECORE_EVENT_NONE) || (type >= event_id_max)) return NULL;
|
||||
eh = calloc(1, sizeof(Ecore_Event_Handler));
|
||||
|
@ -193,6 +195,8 @@ ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, const void *data)
|
|||
EAPI void *
|
||||
ecore_event_handler_del(Ecore_Event_Handler *event_handler)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(event_handler, ECORE_MAGIC_EVENT_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(event_handler, ECORE_MAGIC_EVENT_HANDLER,
|
||||
|
@ -216,6 +220,8 @@ ecore_event_handler_del(Ecore_Event_Handler *event_handler)
|
|||
EAPI void *
|
||||
ecore_event_handler_data_get(Ecore_Event_Handler *eh)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(eh, ECORE_MAGIC_EVENT_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(eh, ECORE_MAGIC_EVENT_HANDLER, "ecore_event_handler_data_get");
|
||||
|
@ -237,6 +243,9 @@ EAPI void *
|
|||
ecore_event_handler_data_set(Ecore_Event_Handler *eh, const void *data)
|
||||
{
|
||||
void *old;
|
||||
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(eh, ECORE_MAGIC_EVENT_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(eh, ECORE_MAGIC_EVENT_HANDLER, "ecore_event_handler_data_set");
|
||||
|
@ -274,6 +283,8 @@ _ecore_event_generic_free (void *data __UNUSED__, void *event)
|
|||
EAPI Ecore_Event *
|
||||
ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
/* if (!ev) return NULL;*/
|
||||
if (type <= ECORE_EVENT_NONE) return NULL;
|
||||
if (type >= event_id_max) return NULL;
|
||||
|
@ -295,6 +306,8 @@ ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data)
|
|||
EAPI void *
|
||||
ecore_event_del(Ecore_Event *event)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(event, ECORE_MAGIC_EVENT))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(event, ECORE_MAGIC_EVENT, "ecore_event_del");
|
||||
|
@ -318,6 +331,8 @@ ecore_event_del(Ecore_Event *event)
|
|||
EAPI int
|
||||
ecore_event_type_new(void)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
event_id_max++;
|
||||
return event_id_max - 1;
|
||||
}
|
||||
|
@ -347,6 +362,8 @@ ecore_event_filter_add(Ecore_Data_Cb func_start, Ecore_Filter_Cb func_filter, Ec
|
|||
{
|
||||
Ecore_Event_Filter *ef;
|
||||
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!func_filter) return NULL;
|
||||
ef = calloc(1, sizeof(Ecore_Event_Filter));
|
||||
if (!ef) return NULL;
|
||||
|
@ -371,6 +388,8 @@ ecore_event_filter_add(Ecore_Data_Cb func_start, Ecore_Filter_Cb func_filter, Ec
|
|||
EAPI void *
|
||||
ecore_event_filter_del(Ecore_Event_Filter *ef)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(ef, ECORE_MAGIC_EVENT_FILTER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(ef, ECORE_MAGIC_EVENT_FILTER, "ecore_event_filter_del");
|
||||
|
|
|
@ -50,6 +50,8 @@ ecore_idle_enterer_add(Ecore_Task_Cb func, const void *data)
|
|||
{
|
||||
Ecore_Idle_Enterer *ie;
|
||||
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!func) return NULL;
|
||||
ie = calloc(1, sizeof(Ecore_Idle_Enterer));
|
||||
if (!ie) return NULL;
|
||||
|
@ -75,6 +77,8 @@ ecore_idle_enterer_before_add(Ecore_Task_Cb func, const void *data)
|
|||
{
|
||||
Ecore_Idle_Enterer *ie;
|
||||
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!func) return NULL;
|
||||
ie = calloc(1, sizeof(Ecore_Idle_Enterer));
|
||||
if (!ie) return NULL;
|
||||
|
@ -94,6 +98,8 @@ ecore_idle_enterer_before_add(Ecore_Task_Cb func, const void *data)
|
|||
EAPI void *
|
||||
ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(idle_enterer, ECORE_MAGIC_IDLE_ENTERER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(idle_enterer, ECORE_MAGIC_IDLE_ENTERER,
|
||||
|
|
|
@ -49,6 +49,8 @@ ecore_idle_exiter_add(Ecore_Task_Cb func, const void *data)
|
|||
{
|
||||
Ecore_Idle_Exiter *ie;
|
||||
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!func) return NULL;
|
||||
ie = calloc(1, sizeof(Ecore_Idle_Exiter));
|
||||
if (!ie) return NULL;
|
||||
|
@ -68,6 +70,8 @@ ecore_idle_exiter_add(Ecore_Task_Cb func, const void *data)
|
|||
EAPI void *
|
||||
ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(idle_exiter, ECORE_MAGIC_IDLE_EXITER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(idle_exiter, ECORE_MAGIC_IDLE_EXITER,
|
||||
|
|
|
@ -674,10 +674,11 @@ _ecore_main_loop_shutdown(void)
|
|||
EAPI void
|
||||
ecore_main_loop_iterate(void)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
#ifndef USE_G_MAIN_LOOP
|
||||
_ecore_main_loop_iterate_internal(1);
|
||||
#else
|
||||
g_main_context_iteration(NULL, 1);
|
||||
g_main_context_iteration(NULL, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -702,6 +703,7 @@ ecore_main_loop_iterate(void)
|
|||
EAPI void
|
||||
ecore_main_loop_begin(void)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
#ifndef USE_G_MAIN_LOOP
|
||||
in_main_loop++;
|
||||
while (do_quit == 0) _ecore_main_loop_iterate_internal(0);
|
||||
|
@ -820,6 +822,8 @@ ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func
|
|||
{
|
||||
Ecore_Fd_Handler *fdh;
|
||||
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if ((fd < 0) || (flags == 0) || (!func)) return NULL;
|
||||
|
||||
fdh = calloc(1, sizeof(Ecore_Fd_Handler));
|
||||
|
@ -895,6 +899,8 @@ ecore_main_win32_handler_add(void *h __UNUSED__, Ecore_Win32_Handle_Cb func __UN
|
|||
EAPI void *
|
||||
ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
|
@ -960,6 +966,8 @@ ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler __UNUSED__)
|
|||
EAPI void
|
||||
ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, const void *data)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
|
@ -1006,6 +1014,8 @@ ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_
|
|||
{
|
||||
int ret = EINA_FALSE;
|
||||
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
|
@ -1029,6 +1039,8 @@ ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_
|
|||
{
|
||||
int ret;
|
||||
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
|
|
|
@ -107,6 +107,8 @@ ecore_timer_precision_get(void)
|
|||
EAPI void
|
||||
ecore_timer_precision_set(double value)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (value < 0.0)
|
||||
{
|
||||
ERR("Precision %f less than zero, ignored", value);
|
||||
|
@ -139,6 +141,8 @@ ecore_timer_add(double in, Ecore_Task_Cb func, const void *data)
|
|||
double now;
|
||||
Ecore_Timer *timer;
|
||||
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!func) return NULL;
|
||||
if (in < 0.0) in = 0.0;
|
||||
timer = calloc(1, sizeof(Ecore_Timer));
|
||||
|
@ -173,6 +177,8 @@ ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data)
|
|||
double now;
|
||||
Ecore_Timer *timer;
|
||||
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!func) return NULL;
|
||||
if (in < 0.0) in = 0.0;
|
||||
timer = calloc(1, sizeof(Ecore_Timer));
|
||||
|
@ -201,6 +207,8 @@ ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data)
|
|||
EAPI void *
|
||||
ecore_timer_del(Ecore_Timer *timer)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
|
@ -237,6 +245,8 @@ ecore_timer_del(Ecore_Timer *timer)
|
|||
EAPI void
|
||||
ecore_timer_interval_set(Ecore_Timer *timer, double in)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
|
@ -255,6 +265,8 @@ ecore_timer_interval_set(Ecore_Timer *timer, double in)
|
|||
EAPI double
|
||||
ecore_timer_interval_get(Ecore_Timer *timer)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
|
@ -275,6 +287,8 @@ ecore_timer_interval_get(Ecore_Timer *timer)
|
|||
EAPI void
|
||||
ecore_timer_delay(Ecore_Timer *timer, double add)
|
||||
{
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
|
@ -304,6 +318,8 @@ ecore_timer_pending_get(Ecore_Timer *timer)
|
|||
{
|
||||
double now;
|
||||
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
|
@ -337,6 +353,8 @@ ecore_timer_freeze(Ecore_Timer *timer)
|
|||
{
|
||||
double now;
|
||||
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
|
@ -376,6 +394,8 @@ ecore_timer_thaw(Ecore_Timer *timer)
|
|||
{
|
||||
double now;
|
||||
|
||||
ECORE_MAIN_LOOP_ASSERT();
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
|
|
Loading…
Reference in New Issue