diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/eina/eina_debug.c | 11 | ||||
-rw-r--r-- | src/lib/eina/eina_debug.h | 7 | ||||
-rw-r--r-- | src/lib/eina/eina_debug_cpu.c | 3 | ||||
-rw-r--r-- | src/lib/eina/eina_lock.c | 3 |
4 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/eina/eina_debug.c b/src/lib/eina/eina_debug.c index ebfe9b6b5c..b71f422123 100644 --- a/src/lib/eina/eina_debug.c +++ b/src/lib/eina/eina_debug.c @@ -762,3 +762,14 @@ eina_debug_shutdown(void) eina_threads_shutdown(); return EINA_TRUE; } + +EAPI void +eina_debug_fork_reset(void) +{ + extern Eina_Bool fork_resetting; + + fork_resetting = EINA_TRUE; + eina_debug_shutdown(); + eina_debug_init(); + fork_resetting = EINA_FALSE; +} diff --git a/src/lib/eina/eina_debug.h b/src/lib/eina/eina_debug.h index a5ef86b0f3..132f598875 100644 --- a/src/lib/eina/eina_debug.h +++ b/src/lib/eina/eina_debug.h @@ -300,6 +300,13 @@ EAPI Eina_Debug_Timer *eina_debug_timer_add(unsigned int timeout_ms, Eina_Debug_ EAPI void eina_debug_timer_del(Eina_Debug_Timer *timer); /** + * @brief Reset the eina debug system after forking + * + * Call this any time the application forks + * @since 1.21 + * */ +EAPI void eina_debug_fork_reset(void); +/** * @} */ diff --git a/src/lib/eina/eina_debug_cpu.c b/src/lib/eina/eina_debug_cpu.c index 2a8d617584..2cc382d84b 100644 --- a/src/lib/eina/eina_debug_cpu.c +++ b/src/lib/eina/eina_debug_cpu.c @@ -337,9 +337,12 @@ _eina_debug_cpu_init(void) Eina_Bool _eina_debug_cpu_shutdown(void) { + extern Eina_Bool fork_resetting; + if (_eina_debug_sysmon_active) eina_lock_take(&_sysmon_lock); _eina_debug_cpu_active = 0; + if (!fork_resetting) eina_condition_wait(&_exit_cond); eina_condition_free(&_exit_cond); eina_lock_release(&_sysmon_lock); diff --git a/src/lib/eina/eina_lock.c b/src/lib/eina/eina_lock.c index 9c560df38e..aa085cd15a 100644 --- a/src/lib/eina/eina_lock.c +++ b/src/lib/eina/eina_lock.c @@ -52,9 +52,12 @@ _eina_spinlock_macos_release(Eina_Spinlock *spinlock) #endif /* EINA_HAVE_OSX_SPINLOCK */ +Eina_Bool fork_resetting; + EAPI void _eina_lock_debug_abort(int err, const char *fn, const volatile void *ptr) { + if (fork_resetting) return; fprintf(stderr, "EINA ERROR: '%s' on %s %p\n", strerror(err), fn, ptr); #ifdef EINA_HAVE_DEBUG_THREADS abort(); |