forked from enlightenment/efl
ephysics: add a log domain usage counter
This way we assure eina log will be working until the last thread ends. SVN revision: 77456
This commit is contained in:
parent
9668304291
commit
a3eda42485
|
@ -12,8 +12,30 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
int _ephysics_log_dom = -1;
|
||||
static int _ephysics_dom_count = 0;
|
||||
static int _ephysics_init_count = 0;
|
||||
|
||||
void
|
||||
ephysics_dom_count_inc(void)
|
||||
{
|
||||
_ephysics_dom_count++;
|
||||
}
|
||||
|
||||
void
|
||||
ephysics_dom_count_dec(void)
|
||||
{
|
||||
_ephysics_dom_count--;
|
||||
if (_ephysics_dom_count)
|
||||
return;
|
||||
|
||||
INF("EPhysics shutdown");
|
||||
|
||||
eina_log_domain_unregister(_ephysics_log_dom);
|
||||
_ephysics_log_dom = -1;
|
||||
|
||||
eina_shutdown();
|
||||
}
|
||||
|
||||
EAPI int
|
||||
ephysics_init()
|
||||
{
|
||||
|
@ -45,6 +67,7 @@ ephysics_init()
|
|||
goto no_world;
|
||||
}
|
||||
|
||||
ephysics_dom_count_inc();
|
||||
INF("EPhysics initialized");
|
||||
|
||||
return _ephysics_init_count;
|
||||
|
@ -66,14 +89,8 @@ ephysics_shutdown()
|
|||
return _ephysics_init_count;
|
||||
|
||||
ephysics_world_shutdown();
|
||||
|
||||
INF("EPhysics shutdown");
|
||||
|
||||
eina_log_domain_unregister(_ephysics_log_dom);
|
||||
_ephysics_log_dom = -1;
|
||||
|
||||
ecore_shutdown();
|
||||
eina_shutdown();
|
||||
ephysics_dom_count_dec();
|
||||
|
||||
return _ephysics_init_count;
|
||||
}
|
||||
|
|
|
@ -97,6 +97,10 @@ struct _EPhysics_Body {
|
|||
|
||||
extern int _ephysics_log_dom;
|
||||
|
||||
/* Main */
|
||||
void ephysics_dom_count_inc(void);
|
||||
void ephysics_dom_count_dec(void);
|
||||
|
||||
/* World */
|
||||
int ephysics_world_init(void);
|
||||
int ephysics_world_shutdown(void);
|
||||
|
|
|
@ -340,6 +340,7 @@ _ephysics_world_free(EPhysics_World *world)
|
|||
|
||||
free(world);
|
||||
INF("World %p deleted.", world);
|
||||
ephysics_dom_count_dec();
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -717,6 +718,7 @@ ephysics_world_new(void)
|
|||
if (!_anim_simulate)
|
||||
_anim_simulate = ecore_animator_add(_simulate_worlds, NULL);
|
||||
|
||||
ephysics_dom_count_inc();
|
||||
INF("World %p added.", world);
|
||||
return world;
|
||||
|
||||
|
|
Loading…
Reference in New Issue