mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Revert "thread_sync.c (rb_mutex_sleep): skip interrupt check before sleep"
This reverts commit 2e420b8b99
(r64464)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f6f54d776e
commit
77038f9f82
2 changed files with 5 additions and 11 deletions
11
thread.c
11
thread.c
|
@ -94,8 +94,7 @@ static ID id_locals;
|
|||
|
||||
enum SLEEP_FLAGS {
|
||||
SLEEP_DEADLOCKABLE = 0x1,
|
||||
SLEEP_SPURIOUS_CHECK = 0x2,
|
||||
SLEEP_BEFORE_CHECK_INTS = 0x4
|
||||
SLEEP_SPURIOUS_CHECK = 0x2
|
||||
};
|
||||
|
||||
static void sleep_timespec(rb_thread_t *, struct timespec, unsigned int fl);
|
||||
|
@ -1188,9 +1187,7 @@ sleep_forever(rb_thread_t *th, unsigned int fl)
|
|||
|
||||
status = fl & SLEEP_DEADLOCKABLE ? THREAD_STOPPED_FOREVER : THREAD_STOPPED;
|
||||
th->status = status;
|
||||
if (!(fl & SLEEP_BEFORE_CHECK_INTS)) {
|
||||
RUBY_VM_CHECK_INTS_BLOCKING(th->ec);
|
||||
}
|
||||
RUBY_VM_CHECK_INTS_BLOCKING(th->ec);
|
||||
while (th->status == status) {
|
||||
if (fl & SLEEP_DEADLOCKABLE) {
|
||||
th->vm->sleeper++;
|
||||
|
@ -1296,9 +1293,7 @@ sleep_timespec(rb_thread_t *th, struct timespec ts, unsigned int fl)
|
|||
getclockofday(&end);
|
||||
timespec_add(&end, &ts);
|
||||
th->status = THREAD_STOPPED;
|
||||
if (!(fl & SLEEP_BEFORE_CHECK_INTS)) {
|
||||
RUBY_VM_CHECK_INTS_BLOCKING(th->ec);
|
||||
}
|
||||
RUBY_VM_CHECK_INTS_BLOCKING(th->ec);
|
||||
while (th->status == THREAD_STOPPED) {
|
||||
native_sleep(th, &ts);
|
||||
woke = vm_check_ints_blocking(th->ec);
|
||||
|
|
|
@ -438,7 +438,7 @@ rb_mutex_cleanup_keeping_mutexes(const rb_thread_t *current_thread)
|
|||
static VALUE
|
||||
rb_mutex_sleep_forever(VALUE time)
|
||||
{
|
||||
sleep_forever(GET_THREAD(), SLEEP_DEADLOCKABLE|SLEEP_BEFORE_CHECK_INTS);
|
||||
rb_thread_sleep_deadly_allow_spurious_wakeup();
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
@ -446,8 +446,7 @@ static VALUE
|
|||
rb_mutex_wait_for(VALUE time)
|
||||
{
|
||||
struct timespec *t = (struct timespec*)time;
|
||||
/* permit spurious check */
|
||||
sleep_timespec(GET_THREAD(), *t, SLEEP_BEFORE_CHECK_INTS);
|
||||
sleep_timespec(GET_THREAD(), *t, 0); /* permit spurious check */
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue