Project

General

Profile

« Previous | Next » 

Revision 6e36841d

Added by peterzhu2118 (Peter Zhu) about 1 month ago

Free rb_native_thread memory at fork

We never freed any resources of rb_native_thread at fork because it would
cause it to hang. This is because it called rb_native_cond_destroy for
condition variables. We can't call rb_native_cond_destroy here because
according to the specs of pthread_cond_destroy:

Attempting to destroy a condition variable upon which other threads
are currently blocked results in undefined behavior.

Specifically, glibc's pthread_cond_destroy waits on all the other listeners.
Since after forking all the threads are dead, the condition variable's
listeners will never wake up, so it will hang forever.

This commit changes it to only free the memory and none of the condition
variables.