summaryrefslogtreecommitdiff
path: root/legacy/ephysics/src/lib/ephysics_main.cpp
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2012-10-04 22:38:11 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-10-04 22:38:11 +0000
commita3eda42485de771f3eb1dbb9839c1600f2953fb6 (patch)
tree35b86b81baf5c655343b851babcd82b50bd18853 /legacy/ephysics/src/lib/ephysics_main.cpp
parent9668304291dc8a9a7201e79e018ee2f65dfcfcf6 (diff)
ephysics: add a log domain usage counter
This way we assure eina log will be working until the last thread ends. SVN revision: 77456
Diffstat (limited to 'legacy/ephysics/src/lib/ephysics_main.cpp')
-rw-r--r--legacy/ephysics/src/lib/ephysics_main.cpp31
1 files changed, 24 insertions, 7 deletions
diff --git a/legacy/ephysics/src/lib/ephysics_main.cpp b/legacy/ephysics/src/lib/ephysics_main.cpp
index 09ad9ce60a..e486f89ad1 100644
--- a/legacy/ephysics/src/lib/ephysics_main.cpp
+++ b/legacy/ephysics/src/lib/ephysics_main.cpp
@@ -12,8 +12,30 @@ extern "C" {
12#endif 12#endif
13 13
14int _ephysics_log_dom = -1; 14int _ephysics_log_dom = -1;
15static int _ephysics_dom_count = 0;
15static int _ephysics_init_count = 0; 16static int _ephysics_init_count = 0;
16 17
18void
19ephysics_dom_count_inc(void)
20{
21 _ephysics_dom_count++;
22}
23
24void
25ephysics_dom_count_dec(void)
26{
27 _ephysics_dom_count--;
28 if (_ephysics_dom_count)
29 return;
30
31 INF("EPhysics shutdown");
32
33 eina_log_domain_unregister(_ephysics_log_dom);
34 _ephysics_log_dom = -1;
35
36 eina_shutdown();
37}
38
17EAPI int 39EAPI int
18ephysics_init() 40ephysics_init()
19{ 41{
@@ -45,6 +67,7 @@ ephysics_init()
45 goto no_world; 67 goto no_world;
46 } 68 }
47 69
70 ephysics_dom_count_inc();
48 INF("EPhysics initialized"); 71 INF("EPhysics initialized");
49 72
50 return _ephysics_init_count; 73 return _ephysics_init_count;
@@ -66,14 +89,8 @@ ephysics_shutdown()
66 return _ephysics_init_count; 89 return _ephysics_init_count;
67 90
68 ephysics_world_shutdown(); 91 ephysics_world_shutdown();
69
70 INF("EPhysics shutdown");
71
72 eina_log_domain_unregister(_ephysics_log_dom);
73 _ephysics_log_dom = -1;
74
75 ecore_shutdown(); 92 ecore_shutdown();
76 eina_shutdown(); 93 ephysics_dom_count_dec();
77 94
78 return _ephysics_init_count; 95 return _ephysics_init_count;
79} 96}