summaryrefslogtreecommitdiff
path: root/thread_sync.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-20 12:26:14 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-20 12:26:14 +0000
commite120cc91f0fedc876e23259ecdb9fb65c71e57dd (patch)
tree440a1259f2547df297909efe4ebd40f5ecf81d51 /thread_sync.c
parent26b9fb4711898189b00ef93183ef9e831f816d63 (diff)
merge revision(s) 57477,57478,57479: [Backport #12405]
use TRUE/FALSE. define rb_thread_sleep_deadly_allow_spurious_wakeup(). * thread.c, thread_sync.c: define new function rb_thread_sleep_deadly_allow_spurious_wakeup() and use it instead of using sleep_forever() directly. allow Queue operation in trap. * thread_sync.c: allow spurious wakeup to check Queue status just after trap. [Bug #12405] * test/thread/test_queue.rb: add a test for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@58036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_sync.c')
-rw-r--r--thread_sync.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/thread_sync.c b/thread_sync.c
index 091246a7ad..2f4c0971e5 100644
--- a/thread_sync.c
+++ b/thread_sync.c
@@ -416,7 +416,7 @@ rb_mutex_abandon_all(rb_mutex_t *mutexes)
static VALUE
rb_mutex_sleep_forever(VALUE time)
{
- sleep_forever(GET_THREAD(), 1, 0); /* permit spurious check */
+ rb_thread_sleep_deadly_allow_spurious_wakeup();
return Qnil;
}
@@ -763,7 +763,7 @@ queue_delete_from_waiting(struct waiting_delete *p)
static VALUE
queue_sleep(VALUE arg)
{
- rb_thread_sleep_deadly();
+ rb_thread_sleep_deadly_allow_spurious_wakeup();
return Qnil;
}