From 5b4aa1ef3ffc5af776b3b737b371e00463e675aa Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 14 Dec 2020 20:01:11 +0100 Subject: [PATCH] :bomb: Fork memory things --- src/lib/shred.c | 3 ++- src/vm/vm.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) 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; } -- 2.43.0