2009-01-31 10:33:39 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
#include "Ecore.h"
|
2009-12-22 13:15:12 -08:00
|
|
|
#include "ecore_private.h"
|
2003-09-23 01:09:32 -07:00
|
|
|
|
2010-01-03 13:55:50 -08:00
|
|
|
|
|
|
|
struct _Ecore_Idle_Enterer
|
|
|
|
{
|
|
|
|
EINA_INLIST;
|
|
|
|
ECORE_MAGIC;
|
2010-08-03 19:55:20 -07:00
|
|
|
Ecore_Task_Cb func;
|
2010-01-03 13:55:50 -08:00
|
|
|
void *data;
|
Fix idle_enterers when using recursive main loops.
If an idle_enterer created a recursive main loop (just called
ecore_main_loop_begin()), then this recursive main loop should
continue to process idle_enterers from there and on, thus
idle_enterer_current was added. When going back from recursion, the
current iterator should be updated properly.
This patch also fixes the deletion of idle_enterers from recursive
main loops by reference counting them. This way, the node will not be
free()d inside inner loop cleanups and then crash when going back to
outer loop.
The following test case used to crash but not anymore:
#include <Ecore.h>
#include <Eina.h>
static int _log_dom;
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
static Ecore_Idle_Enterer *handle;
static int idler(void *data)
{
INF("idler");
return 1;
}
static int cb2(void *data)
{
INF("cb2 - delete cb1 handle");
ecore_idle_enterer_del(handle);
ecore_main_loop_quit(); /* quits inner main loop */
return 0;
}
static int cb1(void *data)
{
INF("cb1: begin");
INF(" add cb2");
ecore_idle_enterer_add(cb2, NULL);
INF(" inner main loop begin (recurse)");
ecore_main_loop_begin(); /* will it crash due ecore_idle_enterer_del(handle)
* inside cb2()? It used to!
*/
INF("cb1: end");
ecore_main_loop_quit(); /* quits outer main loop */
return 0;
}
int main(void)
{
ecore_init();
_log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);
/*
* Creating a new main loop from inside an idle_enterer callback,
* and inside this new (inner) main loop deleting the caller
* callback used to crash since the handle would be effectively
* free()d, but when the recursion is over the pointer would be
* used.
*/
INF("main: begin");
handle = ecore_idle_enterer_add(cb1, NULL);
ecore_idler_add(idler, NULL);
ecore_main_loop_begin();
INF("main: end");
return 0;
}
SVN revision: 46408
2010-02-23 14:13:42 -08:00
|
|
|
int references;
|
|
|
|
Eina_Bool delete_me : 1;
|
2010-01-03 13:55:50 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
static Ecore_Idle_Enterer *idle_enterers = NULL;
|
Fix idle_enterers when using recursive main loops.
If an idle_enterer created a recursive main loop (just called
ecore_main_loop_begin()), then this recursive main loop should
continue to process idle_enterers from there and on, thus
idle_enterer_current was added. When going back from recursion, the
current iterator should be updated properly.
This patch also fixes the deletion of idle_enterers from recursive
main loops by reference counting them. This way, the node will not be
free()d inside inner loop cleanups and then crash when going back to
outer loop.
The following test case used to crash but not anymore:
#include <Ecore.h>
#include <Eina.h>
static int _log_dom;
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
static Ecore_Idle_Enterer *handle;
static int idler(void *data)
{
INF("idler");
return 1;
}
static int cb2(void *data)
{
INF("cb2 - delete cb1 handle");
ecore_idle_enterer_del(handle);
ecore_main_loop_quit(); /* quits inner main loop */
return 0;
}
static int cb1(void *data)
{
INF("cb1: begin");
INF(" add cb2");
ecore_idle_enterer_add(cb2, NULL);
INF(" inner main loop begin (recurse)");
ecore_main_loop_begin(); /* will it crash due ecore_idle_enterer_del(handle)
* inside cb2()? It used to!
*/
INF("cb1: end");
ecore_main_loop_quit(); /* quits outer main loop */
return 0;
}
int main(void)
{
ecore_init();
_log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);
/*
* Creating a new main loop from inside an idle_enterer callback,
* and inside this new (inner) main loop deleting the caller
* callback used to crash since the handle would be effectively
* free()d, but when the recursion is over the pointer would be
* used.
*/
INF("main: begin");
handle = ecore_idle_enterer_add(cb1, NULL);
ecore_idler_add(idler, NULL);
ecore_main_loop_begin();
INF("main: end");
return 0;
}
SVN revision: 46408
2010-02-23 14:13:42 -08:00
|
|
|
static Ecore_Idle_Enterer *idle_enterer_current = NULL;
|
2003-09-23 01:09:32 -07:00
|
|
|
static int idle_enterers_delete_me = 0;
|
|
|
|
|
2011-07-28 05:01:16 -07:00
|
|
|
static void *
|
|
|
|
_ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer);
|
|
|
|
|
2010-10-17 00:03:28 -07:00
|
|
|
/**
|
|
|
|
* @addtogroup Ecore_Group Ecore - Main Loop and Job Functions.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup Ecore_Idle_Group Ecore Idle functions
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
/**
|
|
|
|
* Add an idle enterer handler.
|
2004-05-07 21:44:04 -07:00
|
|
|
* @param func The function to call when entering an idle state.
|
|
|
|
* @param data The data to be passed to the @p func call
|
|
|
|
* @return A handle to the idle enterer callback if successful. Otherwise,
|
|
|
|
* NULL is returned.
|
2011-06-22 11:29:38 -07:00
|
|
|
* @note The function func will be called every time the main loop is entering
|
|
|
|
* idle state, as long as it returns 1 (or ECORE_CALLBACK_RENEW). A return of 0
|
|
|
|
* (or ECORE_CALLBACK_CANCEL) deletes the idle enterer.
|
2003-09-23 01:09:32 -07:00
|
|
|
*/
|
2006-01-06 09:58:12 -08:00
|
|
|
EAPI Ecore_Idle_Enterer *
|
2010-08-03 19:55:20 -07:00
|
|
|
ecore_idle_enterer_add(Ecore_Task_Cb func, const void *data)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2011-07-28 05:01:16 -07:00
|
|
|
Ecore_Idle_Enterer *ie = NULL;
|
2003-09-23 01:09:32 -07:00
|
|
|
|
2011-07-28 05:01:16 -07:00
|
|
|
_ecore_lock();
|
2011-07-05 04:13:29 -07:00
|
|
|
|
2011-07-28 05:01:16 -07:00
|
|
|
if (!func) goto unlock;
|
2003-09-23 01:09:32 -07:00
|
|
|
ie = calloc(1, sizeof(Ecore_Idle_Enterer));
|
2011-07-28 05:01:16 -07:00
|
|
|
if (!ie) goto unlock;
|
2003-09-23 01:09:32 -07:00
|
|
|
ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER);
|
|
|
|
ie->func = func;
|
|
|
|
ie->data = (void *)data;
|
2009-06-17 04:39:37 -07:00
|
|
|
idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_append(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
|
2011-07-28 05:01:16 -07:00
|
|
|
unlock:
|
|
|
|
_ecore_unlock();
|
2003-09-23 01:09:32 -07:00
|
|
|
return ie;
|
|
|
|
}
|
|
|
|
|
2008-01-10 23:33:57 -08:00
|
|
|
/**
|
|
|
|
* Add an idle enterer handler at the start of the list so it gets called earlier than others.
|
|
|
|
* @param func The function to call when entering an idle state.
|
|
|
|
* @param data The data to be passed to the @p func call
|
|
|
|
* @return A handle to the idle enterer callback if successful. Otherwise,
|
|
|
|
* NULL is returned.
|
2011-06-22 11:29:38 -07:00
|
|
|
* @note The function func will be called every time the main loop is entering
|
|
|
|
* idle state, as long as it returns 1 (or ECORE_CALLBACK_RENEW). A return of 0
|
|
|
|
* (or ECORE_CALLBACK_CANCEL) deletes the idle enterer.
|
2008-01-10 23:33:57 -08:00
|
|
|
*/
|
|
|
|
EAPI Ecore_Idle_Enterer *
|
2010-08-03 19:55:20 -07:00
|
|
|
ecore_idle_enterer_before_add(Ecore_Task_Cb func, const void *data)
|
2008-01-10 23:33:57 -08:00
|
|
|
{
|
2011-07-28 05:01:16 -07:00
|
|
|
Ecore_Idle_Enterer *ie = NULL;
|
2008-01-10 23:33:57 -08:00
|
|
|
|
2011-07-28 05:01:16 -07:00
|
|
|
_ecore_lock();
|
2011-07-05 04:13:29 -07:00
|
|
|
|
2011-07-28 05:01:16 -07:00
|
|
|
if (!func) goto unlock;
|
2008-01-10 23:33:57 -08:00
|
|
|
ie = calloc(1, sizeof(Ecore_Idle_Enterer));
|
2011-07-28 05:01:16 -07:00
|
|
|
if (!ie) goto unlock;
|
2008-01-10 23:33:57 -08:00
|
|
|
ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER);
|
|
|
|
ie->func = func;
|
|
|
|
ie->data = (void *)data;
|
2009-06-17 04:39:37 -07:00
|
|
|
idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_prepend(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
|
2011-07-28 05:01:16 -07:00
|
|
|
unlock:
|
|
|
|
_ecore_unlock();
|
2008-01-10 23:33:57 -08:00
|
|
|
return ie;
|
|
|
|
}
|
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
/**
|
2004-05-07 21:44:04 -07:00
|
|
|
* Delete an idle enterer callback.
|
|
|
|
* @param idle_enterer The idle enterer to delete
|
|
|
|
* @return The data pointer passed to the idler enterer callback on success.
|
|
|
|
* NULL otherwise.
|
2003-09-23 01:09:32 -07:00
|
|
|
*/
|
2006-01-06 09:58:12 -08:00
|
|
|
EAPI void *
|
2003-09-23 01:09:32 -07:00
|
|
|
ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer)
|
|
|
|
{
|
2011-07-28 05:01:16 -07:00
|
|
|
void *data;
|
2011-07-05 04:13:29 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
if (!ECORE_MAGIC_CHECK(idle_enterer, ECORE_MAGIC_IDLE_ENTERER))
|
|
|
|
{
|
2010-09-29 23:09:20 -07:00
|
|
|
ECORE_MAGIC_FAIL(idle_enterer, ECORE_MAGIC_IDLE_ENTERER,
|
|
|
|
"ecore_idle_enterer_del");
|
|
|
|
return NULL;
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
2011-07-28 05:01:16 -07:00
|
|
|
_ecore_lock();
|
|
|
|
data = _ecore_idle_enterer_del(idle_enterer);
|
|
|
|
_ecore_unlock();
|
|
|
|
return data;
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
2010-10-17 00:03:28 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2011-07-28 05:01:16 -07:00
|
|
|
static void *
|
|
|
|
_ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_TRUE_RETURN_VAL(idle_enterer->delete_me, NULL);
|
|
|
|
idle_enterer->delete_me = 1;
|
|
|
|
idle_enterers_delete_me = 1;
|
|
|
|
return idle_enterer->data;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
void
|
|
|
|
_ecore_idle_enterer_shutdown(void)
|
|
|
|
{
|
2009-06-17 04:39:37 -07:00
|
|
|
Ecore_Idle_Enterer *ie;
|
|
|
|
while ((ie = idle_enterers))
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2010-09-29 23:09:20 -07:00
|
|
|
idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(idle_enterers));
|
|
|
|
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
|
|
|
free(ie);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
idle_enterers_delete_me = 0;
|
Fix idle_enterers when using recursive main loops.
If an idle_enterer created a recursive main loop (just called
ecore_main_loop_begin()), then this recursive main loop should
continue to process idle_enterers from there and on, thus
idle_enterer_current was added. When going back from recursion, the
current iterator should be updated properly.
This patch also fixes the deletion of idle_enterers from recursive
main loops by reference counting them. This way, the node will not be
free()d inside inner loop cleanups and then crash when going back to
outer loop.
The following test case used to crash but not anymore:
#include <Ecore.h>
#include <Eina.h>
static int _log_dom;
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
static Ecore_Idle_Enterer *handle;
static int idler(void *data)
{
INF("idler");
return 1;
}
static int cb2(void *data)
{
INF("cb2 - delete cb1 handle");
ecore_idle_enterer_del(handle);
ecore_main_loop_quit(); /* quits inner main loop */
return 0;
}
static int cb1(void *data)
{
INF("cb1: begin");
INF(" add cb2");
ecore_idle_enterer_add(cb2, NULL);
INF(" inner main loop begin (recurse)");
ecore_main_loop_begin(); /* will it crash due ecore_idle_enterer_del(handle)
* inside cb2()? It used to!
*/
INF("cb1: end");
ecore_main_loop_quit(); /* quits outer main loop */
return 0;
}
int main(void)
{
ecore_init();
_log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);
/*
* Creating a new main loop from inside an idle_enterer callback,
* and inside this new (inner) main loop deleting the caller
* callback used to crash since the handle would be effectively
* free()d, but when the recursion is over the pointer would be
* used.
*/
INF("main: begin");
handle = ecore_idle_enterer_add(cb1, NULL);
ecore_idler_add(idler, NULL);
ecore_main_loop_begin();
INF("main: end");
return 0;
}
SVN revision: 46408
2010-02-23 14:13:42 -08:00
|
|
|
idle_enterer_current = NULL;
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_idle_enterer_call(void)
|
|
|
|
{
|
Fix idle_enterers when using recursive main loops.
If an idle_enterer created a recursive main loop (just called
ecore_main_loop_begin()), then this recursive main loop should
continue to process idle_enterers from there and on, thus
idle_enterer_current was added. When going back from recursion, the
current iterator should be updated properly.
This patch also fixes the deletion of idle_enterers from recursive
main loops by reference counting them. This way, the node will not be
free()d inside inner loop cleanups and then crash when going back to
outer loop.
The following test case used to crash but not anymore:
#include <Ecore.h>
#include <Eina.h>
static int _log_dom;
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
static Ecore_Idle_Enterer *handle;
static int idler(void *data)
{
INF("idler");
return 1;
}
static int cb2(void *data)
{
INF("cb2 - delete cb1 handle");
ecore_idle_enterer_del(handle);
ecore_main_loop_quit(); /* quits inner main loop */
return 0;
}
static int cb1(void *data)
{
INF("cb1: begin");
INF(" add cb2");
ecore_idle_enterer_add(cb2, NULL);
INF(" inner main loop begin (recurse)");
ecore_main_loop_begin(); /* will it crash due ecore_idle_enterer_del(handle)
* inside cb2()? It used to!
*/
INF("cb1: end");
ecore_main_loop_quit(); /* quits outer main loop */
return 0;
}
int main(void)
{
ecore_init();
_log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);
/*
* Creating a new main loop from inside an idle_enterer callback,
* and inside this new (inner) main loop deleting the caller
* callback used to crash since the handle would be effectively
* free()d, but when the recursion is over the pointer would be
* used.
*/
INF("main: begin");
handle = ecore_idle_enterer_add(cb1, NULL);
ecore_idler_add(idler, NULL);
ecore_main_loop_begin();
INF("main: end");
return 0;
}
SVN revision: 46408
2010-02-23 14:13:42 -08:00
|
|
|
if (!idle_enterer_current)
|
|
|
|
{
|
2010-09-29 23:09:20 -07:00
|
|
|
/* regular main loop, start from head */
|
|
|
|
idle_enterer_current = idle_enterers;
|
Fix idle_enterers when using recursive main loops.
If an idle_enterer created a recursive main loop (just called
ecore_main_loop_begin()), then this recursive main loop should
continue to process idle_enterers from there and on, thus
idle_enterer_current was added. When going back from recursion, the
current iterator should be updated properly.
This patch also fixes the deletion of idle_enterers from recursive
main loops by reference counting them. This way, the node will not be
free()d inside inner loop cleanups and then crash when going back to
outer loop.
The following test case used to crash but not anymore:
#include <Ecore.h>
#include <Eina.h>
static int _log_dom;
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
static Ecore_Idle_Enterer *handle;
static int idler(void *data)
{
INF("idler");
return 1;
}
static int cb2(void *data)
{
INF("cb2 - delete cb1 handle");
ecore_idle_enterer_del(handle);
ecore_main_loop_quit(); /* quits inner main loop */
return 0;
}
static int cb1(void *data)
{
INF("cb1: begin");
INF(" add cb2");
ecore_idle_enterer_add(cb2, NULL);
INF(" inner main loop begin (recurse)");
ecore_main_loop_begin(); /* will it crash due ecore_idle_enterer_del(handle)
* inside cb2()? It used to!
*/
INF("cb1: end");
ecore_main_loop_quit(); /* quits outer main loop */
return 0;
}
int main(void)
{
ecore_init();
_log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);
/*
* Creating a new main loop from inside an idle_enterer callback,
* and inside this new (inner) main loop deleting the caller
* callback used to crash since the handle would be effectively
* free()d, but when the recursion is over the pointer would be
* used.
*/
INF("main: begin");
handle = ecore_idle_enterer_add(cb1, NULL);
ecore_idler_add(idler, NULL);
ecore_main_loop_begin();
INF("main: end");
return 0;
}
SVN revision: 46408
2010-02-23 14:13:42 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-09-29 23:09:20 -07:00
|
|
|
/* recursive main loop, continue from where we were */
|
|
|
|
idle_enterer_current =
|
|
|
|
(Ecore_Idle_Enterer *)EINA_INLIST_GET(idle_enterer_current)->next;
|
Fix idle_enterers when using recursive main loops.
If an idle_enterer created a recursive main loop (just called
ecore_main_loop_begin()), then this recursive main loop should
continue to process idle_enterers from there and on, thus
idle_enterer_current was added. When going back from recursion, the
current iterator should be updated properly.
This patch also fixes the deletion of idle_enterers from recursive
main loops by reference counting them. This way, the node will not be
free()d inside inner loop cleanups and then crash when going back to
outer loop.
The following test case used to crash but not anymore:
#include <Ecore.h>
#include <Eina.h>
static int _log_dom;
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
static Ecore_Idle_Enterer *handle;
static int idler(void *data)
{
INF("idler");
return 1;
}
static int cb2(void *data)
{
INF("cb2 - delete cb1 handle");
ecore_idle_enterer_del(handle);
ecore_main_loop_quit(); /* quits inner main loop */
return 0;
}
static int cb1(void *data)
{
INF("cb1: begin");
INF(" add cb2");
ecore_idle_enterer_add(cb2, NULL);
INF(" inner main loop begin (recurse)");
ecore_main_loop_begin(); /* will it crash due ecore_idle_enterer_del(handle)
* inside cb2()? It used to!
*/
INF("cb1: end");
ecore_main_loop_quit(); /* quits outer main loop */
return 0;
}
int main(void)
{
ecore_init();
_log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);
/*
* Creating a new main loop from inside an idle_enterer callback,
* and inside this new (inner) main loop deleting the caller
* callback used to crash since the handle would be effectively
* free()d, but when the recursion is over the pointer would be
* used.
*/
INF("main: begin");
handle = ecore_idle_enterer_add(cb1, NULL);
ecore_idler_add(idler, NULL);
ecore_main_loop_begin();
INF("main: end");
return 0;
}
SVN revision: 46408
2010-02-23 14:13:42 -08:00
|
|
|
}
|
2008-11-29 03:23:17 -08:00
|
|
|
|
Fix idle_enterers when using recursive main loops.
If an idle_enterer created a recursive main loop (just called
ecore_main_loop_begin()), then this recursive main loop should
continue to process idle_enterers from there and on, thus
idle_enterer_current was added. When going back from recursion, the
current iterator should be updated properly.
This patch also fixes the deletion of idle_enterers from recursive
main loops by reference counting them. This way, the node will not be
free()d inside inner loop cleanups and then crash when going back to
outer loop.
The following test case used to crash but not anymore:
#include <Ecore.h>
#include <Eina.h>
static int _log_dom;
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
static Ecore_Idle_Enterer *handle;
static int idler(void *data)
{
INF("idler");
return 1;
}
static int cb2(void *data)
{
INF("cb2 - delete cb1 handle");
ecore_idle_enterer_del(handle);
ecore_main_loop_quit(); /* quits inner main loop */
return 0;
}
static int cb1(void *data)
{
INF("cb1: begin");
INF(" add cb2");
ecore_idle_enterer_add(cb2, NULL);
INF(" inner main loop begin (recurse)");
ecore_main_loop_begin(); /* will it crash due ecore_idle_enterer_del(handle)
* inside cb2()? It used to!
*/
INF("cb1: end");
ecore_main_loop_quit(); /* quits outer main loop */
return 0;
}
int main(void)
{
ecore_init();
_log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);
/*
* Creating a new main loop from inside an idle_enterer callback,
* and inside this new (inner) main loop deleting the caller
* callback used to crash since the handle would be effectively
* free()d, but when the recursion is over the pointer would be
* used.
*/
INF("main: begin");
handle = ecore_idle_enterer_add(cb1, NULL);
ecore_idler_add(idler, NULL);
ecore_main_loop_begin();
INF("main: end");
return 0;
}
SVN revision: 46408
2010-02-23 14:13:42 -08:00
|
|
|
while (idle_enterer_current)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2010-09-29 23:09:20 -07:00
|
|
|
Ecore_Idle_Enterer *ie = (Ecore_Idle_Enterer *)idle_enterer_current;
|
|
|
|
if (!ie->delete_me)
|
|
|
|
{
|
2011-07-28 05:01:16 -07:00
|
|
|
Ecore_Task_Cb func;
|
|
|
|
void *data;
|
|
|
|
Eina_Bool ret;
|
|
|
|
|
|
|
|
func = ie->func;
|
|
|
|
data = ie->data;
|
2010-09-29 23:09:20 -07:00
|
|
|
ie->references++;
|
2011-07-28 05:01:16 -07:00
|
|
|
_ecore_unlock();
|
|
|
|
ret = func(data);
|
|
|
|
_ecore_lock();
|
|
|
|
if (!ret)
|
2010-09-29 23:09:20 -07:00
|
|
|
{
|
2011-07-28 05:01:16 -07:00
|
|
|
if (!ie->delete_me) _ecore_idle_enterer_del(ie);
|
2010-09-29 23:09:20 -07:00
|
|
|
}
|
|
|
|
ie->references--;
|
|
|
|
}
|
|
|
|
if (idle_enterer_current) /* may have changed in recursive main loops */
|
|
|
|
idle_enterer_current =
|
|
|
|
(Ecore_Idle_Enterer *)EINA_INLIST_GET(idle_enterer_current)->next;
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
if (idle_enterers_delete_me)
|
|
|
|
{
|
2009-06-17 04:39:37 -07:00
|
|
|
Ecore_Idle_Enterer *l;
|
2010-09-29 23:09:20 -07:00
|
|
|
int deleted_idler_enterers_in_use = 0;
|
|
|
|
|
|
|
|
for (l = idle_enterers; l;)
|
|
|
|
{
|
|
|
|
Ecore_Idle_Enterer *ie = l;
|
|
|
|
l = (Ecore_Idle_Enterer *) EINA_INLIST_GET(l)->next;
|
|
|
|
if (ie->delete_me)
|
|
|
|
{
|
|
|
|
if (ie->references)
|
|
|
|
{
|
|
|
|
deleted_idler_enterers_in_use++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
|
|
|
|
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
|
|
|
free(ie);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!deleted_idler_enterers_in_use)
|
|
|
|
idle_enterers_delete_me = 0;
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
_ecore_idle_enterer_exist(void)
|
|
|
|
{
|
|
|
|
if (idle_enterers) return 1;
|
|
|
|
return 0;
|
|
|
|
}
|