mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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_4@57879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9258462e2a
commit
0c72a8f091
4 changed files with 31 additions and 6 deletions
|
@ -420,7 +420,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;
|
||||
}
|
||||
|
||||
|
@ -773,7 +773,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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue