summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-03 15:45:00 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-03 15:45:00 (GMT)
commite6b065340692cfc2a0cf6c7b32f9e6e413e7f2a1 (patch)
treeeb456b833f2cde5d4f25bf1e2a5d6b2ea83ef99e /thread.c
parentf18951abda345829b5b18f489992498b522a13e5 (diff)
thread.c: volatile inside EXEC_TAG
* thread.c (rb_thread_io_blocking_region): assigned variables inside EXEC_TAG() should be volatile. * thread.c (rb_thread_s_handle_interrupt): ditto. * thread.c (exec_recursive): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/thread.c b/thread.c
index 4ac93e8..4f533d0 100644
--- a/thread.c
+++ b/thread.c
@@ -1386,9 +1386,9 @@ rb_thread_call_without_gvl(void *(*func)(void *data), void *data1,
VALUE
rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd)
{
- VALUE val = Qundef; /* shouldn't be used */
+ volatile VALUE val = Qundef; /* shouldn't be used */
rb_thread_t *th = GET_THREAD();
- int saved_errno = 0;
+ volatile int saved_errno = 0;
int state;
th->waiting_fd = fd;
@@ -1787,7 +1787,7 @@ rb_thread_s_handle_interrupt(VALUE self, VALUE mask_arg)
{
VALUE mask;
rb_thread_t *th = GET_THREAD();
- VALUE r = Qnil;
+ volatile VALUE r = Qnil;
int state;
if (!rb_block_given_p()) {
@@ -4859,10 +4859,11 @@ exec_recursive(VALUE (*func) (VALUE, VALUE, int), VALUE obj, VALUE pairid, VALUE
}
}
else {
+ volatile VALUE ret = Qundef;
recursive_push(p.list, p.objid, p.pairid);
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
- result = (*func)(obj, arg, FALSE);
+ ret = (*func)(obj, arg, FALSE);
}
POP_TAG();
if (!recursive_pop(p.list, p.objid, p.pairid)) {
@@ -4872,6 +4873,7 @@ exec_recursive(VALUE (*func) (VALUE, VALUE, int), VALUE obj, VALUE pairid, VALUE
sym, rb_thread_current());
}
if (state) JUMP_TAG(state);
+ result = ret;
}
}
*(volatile struct exec_recursive_params *)&p;