From eb38fb670bb74522f253cca440bccfd8d8d63c3c Mon Sep 17 00:00:00 2001 From: normal Date: Fri, 30 Nov 2018 03:56:29 +0000 Subject: vm_trace.c: workqueue as thread-safe version of postponed_job postponed_job is safe to use in signal handlers, but is not thread-safe for MJIT. Implement a workqueue for MJIT thread-safety. [Bug #15316] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_core.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'vm_core.h') diff --git a/vm_core.h b/vm_core.h index c557562e17..fd47aed804 100644 --- a/vm_core.h +++ b/vm_core.h @@ -638,12 +638,16 @@ typedef struct rb_vm_struct { /* relation table of ensure - rollback for callcc */ struct st_table *ensure_rollback_table; - /* postponed_job */ + /* postponed_job (async-signal-safe, NOT thread-safe) */ struct rb_postponed_job_struct *postponed_job_buffer; int postponed_job_index; int src_encoding_index; + /* workqueue (thread-safe, NOT async-signal-safe) */ + struct list_head workqueue; /* <=> rb_workqueue_job.jnode */ + rb_nativethread_lock_t workqueue_lock; + VALUE verbose, debug, orig_progname, progname; VALUE coverages; int coverage_mode; @@ -1628,6 +1632,7 @@ rb_vm_living_threads_init(rb_vm_t *vm) { list_head_init(&vm->waiting_fds); list_head_init(&vm->waiting_pids); + list_head_init(&vm->workqueue); list_head_init(&vm->waiting_grps); list_head_init(&vm->living_threads); vm->living_thread_num = 0; -- cgit v1.2.3