summaryrefslogtreecommitdiff
path: root/cont.c
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2019-06-20 20:29:35 +1200
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2019-06-20 22:36:30 +1200
commitf607e433520218ac2adc93fcf32bc3b797219a60 (patch)
tree789d187b051851772df194454e219b5e7c4063d8 /cont.c
parent3077cb6912033d18f4d34fd64011e9f8e9502b99 (diff)
Transition root fiber into state FIBER_TERMINATED.
During fork, it's possible that threads with root fibers are terminated, but fiber state is not updated. `fiber_verify` will subsequently fail. We forcefully enter the FIBER_TERMINATED state when terminating the root fiber.
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/cont.c b/cont.c
index b83a0ad94c..dacc241515 100644
--- a/cont.c
+++ b/cont.c
@@ -1581,6 +1581,17 @@ rb_threadptr_root_fiber_release(rb_thread_t *th)
}
}
+void
+rb_threadptr_root_fiber_terminate(rb_thread_t *th)
+{
+ rb_fiber_t *fiber = th->ec->fiber_ptr;
+
+ fiber->status = FIBER_TERMINATED;
+
+ // The vm_stack is `alloca`ed on the thread stack, so it's gone too:
+ rb_ec_clear_vm_stack(th->ec);
+}
+
static inline rb_fiber_t*
fiber_current(void)
{