path: root/mjit_worker.c
diff options
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 /mjit_worker.c
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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit_worker.c')
1 files changed, 4 insertions, 1 deletions
diff --git a/mjit_worker.c b/mjit_worker.c
index 6a90971..90aaf9d 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -1133,6 +1133,9 @@ static mjit_copy_job_t mjit_copy_job;
static void mjit_copy_job_handler(void *data);
+/* vm_trace.c */
+int rb_workqueue_register(unsigned flags, rb_postponed_job_func_t , void *);
/* We're lazily copying cache values from main thread because these cache values
could be different between ones on enqueue timing and ones on dequeue timing.
Return TRUE if copy succeeds. */
@@ -1148,7 +1151,7 @@ copy_cache_from_main_thread(mjit_copy_job_t *job)
return job->finish_p;
- if (!rb_postponed_job_register(0, mjit_copy_job_handler, (void *)job))
+ if (!rb_workqueue_register(0, mjit_copy_job_handler, (void *)job))
return FALSE;
CRITICAL_SECTION_START(3, "in MJIT copy job wait");
/* checking `stop_worker_p` too because `RUBY_VM_CHECK_INTS(ec)` may not