ecore: prune existing thread_join callbacks during ecore_fork_reset

permitting these to persist and trigger at a later point will cause
the process to deadlock while attempting to join non-existent threads

@fix
This commit is contained in:
Mike Blumenkrantz 2018-01-25 15:32:14 -05:00
parent 359a6cdc0e
commit 8f2b36b774
2 changed files with 16 additions and 2 deletions

View File

@ -68,6 +68,8 @@ static int _ecore_init_count_threshold = 0;
int _ecore_log_dom = -1;
int _ecore_fps_debug = 0;
extern void (*_ecore_thread_join)();
typedef struct _Ecore_Safe_Call Ecore_Safe_Call;
struct _Ecore_Safe_Call
{
@ -577,7 +579,19 @@ ecore_fork_reset(void)
ecore_pipe_del(_thread_call);
_thread_call = ecore_pipe_add(_thread_callback, NULL);
/* If there was something in the pipe, trigger a wakeup again */
if (_thread_cb) ecore_pipe_write(_thread_call, &wakeup, sizeof (int));
if (_thread_cb)
{
Ecore_Safe_Call *call;
EINA_LIST_FOREACH_SAFE(_thread_cb, l, ln, call)
{
if (call->suspend || call->sync) continue;
if (call->cb.async != (Ecore_Cb)&_ecore_thread_join) continue;
_thread_cb = eina_list_remove_list(_thread_cb, l);
free(call);
}
if (_thread_cb) ecore_pipe_write(_thread_call, &wakeup, sizeof (int));
}
eina_lock_release(&_thread_safety);

View File

@ -208,7 +208,7 @@ _ecore_thread_data_free(void *data)
free(d);
}
static void
void
_ecore_thread_join(PH(thread))
{
DBG("joining thread=%" PRIu64, (uint64_t)thread);