mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
thread_pthread.c: fix thread cache for non-monotonic clock
I noticed this because of https://bugs.ruby-lang.org/issues/14494 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
628be3b7dc
commit
4651ef77d2
1 changed files with 2 additions and 4 deletions
|
@ -894,15 +894,13 @@ thread_cache_reset(void)
|
||||||
static rb_thread_t *
|
static rb_thread_t *
|
||||||
register_cached_thread_and_wait(rb_nativethread_id_t thread_self_id)
|
register_cached_thread_and_wait(rb_nativethread_id_t thread_self_id)
|
||||||
{
|
{
|
||||||
struct timespec end;
|
struct timespec end = { 60, 0 };
|
||||||
struct cached_thread_entry entry;
|
struct cached_thread_entry entry;
|
||||||
|
|
||||||
rb_native_cond_initialize(&entry.cond, RB_CONDATTR_CLOCK_MONOTONIC);
|
rb_native_cond_initialize(&entry.cond, RB_CONDATTR_CLOCK_MONOTONIC);
|
||||||
entry.th = NULL;
|
entry.th = NULL;
|
||||||
entry.thread_id = thread_self_id;
|
entry.thread_id = thread_self_id;
|
||||||
|
end = native_cond_timeout(&entry.cond, end);
|
||||||
getclockofday(&end);
|
|
||||||
end.tv_sec += 60;
|
|
||||||
|
|
||||||
rb_native_mutex_lock(&thread_cache_lock);
|
rb_native_mutex_lock(&thread_cache_lock);
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue