summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-06 09:14:40 +0900
committerJeremy Evans <code@jeremyevans.net>2021-07-25 13:09:03 -0700
commit070557afc4ca83876b951fe090806b59e3867ae5 (patch)
tree9756aa96026efd552184011ad45c05f2027e19aa /thread.c
parent8897098b5ca3ce987307d1799f7765e6a279ff0d (diff)
Distinguish signal and timeout [Bug #16608]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4256
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/thread.c b/thread.c
index 47bbb4257c..0f6838e141 100644
--- a/thread.c
+++ b/thread.c
@@ -132,7 +132,7 @@ rb_thread_local_storage(VALUE thread)
return rb_ivar_get(thread, idLocals);
}
-static void sleep_hrtime(rb_thread_t *, rb_hrtime_t, unsigned int fl);
+static int sleep_hrtime(rb_thread_t *, rb_hrtime_t, unsigned int fl);
static void sleep_forever(rb_thread_t *th, unsigned int fl);
static void rb_thread_sleep_deadly_allow_spurious_wakeup(VALUE blocker);
static int rb_threadptr_dead(rb_thread_t *th);
@@ -1479,7 +1479,7 @@ hrtime_update_expire(rb_hrtime_t *timeout, const rb_hrtime_t end)
}
COMPILER_WARNING_POP
-static void
+static int
sleep_hrtime(rb_thread_t *th, rb_hrtime_t rel, unsigned int fl)
{
enum rb_thread_status prev_status = th->status;
@@ -1495,8 +1495,10 @@ sleep_hrtime(rb_thread_t *th, rb_hrtime_t rel, unsigned int fl)
break;
if (hrtime_update_expire(&rel, end))
break;
+ woke = 1;
}
th->status = prev_status;
+ return woke;
}
void