From: Jérémie Astor Date: Mon, 14 Dec 2020 19:01:11 +0000 (+0100) Subject: :bomb: Fork memory things X-Git-Tag: nightly~1105^2~24 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=5b4aa1ef3ffc5af776b3b737b371e00463e675aa;p=gwion.git :bomb: Fork memory things --- diff --git a/src/lib/shred.c b/src/lib/shred.c index a9c9ddcb..25dcb175 100644 --- a/src/lib/shred.c +++ b/src/lib/shred.c @@ -177,7 +177,7 @@ static void stop(const M_Object o) { MUTEX_UNLOCK(vm->shreduler->mutex); } -static void join(const M_Object o) { +static inline void join(const M_Object o) { if(FORK_THREAD(o)) { THREAD_JOIN(FORK_THREAD(o)); FORK_THREAD(o) = 0; @@ -187,6 +187,7 @@ static void join(const M_Object o) { static DTOR(fork_dtor) { *(m_int*)(o->data + o_fork_done) = 1; stop(o); + join(o); VM *parent = ME(o)->info->vm->parent; MUTEX_LOCK(parent->shreduler->mutex); if(parent->gwion->data->child.ptr) { diff --git a/src/vm/vm.c b/src/vm/vm.c index d010c946..d9c28002 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -129,6 +129,7 @@ ANN static inline VM_Shred init_spork_shred(const VM_Shred shred, const VM_Code if(!shred->tick->child.ptr) vector_init(&shred->tick->child); vector_add(&shred->tick->child, (vtype)sh); + vector_add(&shred->gc, (vtype)sh->info->me); return sh; }