summaryrefslogtreecommitdiff
path: root/vm_core.h
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-30 03:56:29 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-30 03:56:29 +0000
commiteb38fb670bb74522f253cca440bccfd8d8d63c3c (patch)
treedce0e338bae7264c9fbeeb610b7a484f14326be9 /vm_core.h
parentd7e4e50bdb9478c3e60ae855abcf2596991c976b (diff)
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
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h7
1 files changed, 6 insertions, 1 deletions
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;