* thread_pthread.c (native_sleep): cut the waiting time up to

100,000,000 because Solaris cond_timedwait() return EINVAL if an
  argument is greater than current_time + 100,000,000.  This is
  considered as a kind of spurious wakeup.  The caller to native_sleep
  should care about spurious wakeup.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2011-07-04 16:32:21 +00:00
Родитель d6a5698d8a
Коммит fed26e916b
2 изменённых файлов: 21 добавлений и 0 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Tue Jul 5 01:30:01 2011 Yusuke Endoh <mame@tsg.ne.jp>
* thread_pthread.c (native_sleep): cut the waiting time up to
100,000,000 because Solaris cond_timedwait() return EINVAL if an
argument is greater than current_time + 100,000,000. This is
considered as a kind of spurious wakeup. The caller to native_sleep
should care about spurious wakeup.
Tue Jul 5 01:24:26 2011 Yusuke Endoh <mame@tsg.ne.jp>
* cont.c: disable FIBER_USE_NATIVE on Solaris because resuming any

Просмотреть файл

@ -857,6 +857,19 @@ native_sleep(rb_thread_t *th, struct timeval *timeout_tv)
timeout_rel.tv_sec = timeout_tv->tv_sec;
timeout_rel.tv_nsec = timeout_tv->tv_usec * 1000;
/* Solaris cond_timedwait() return EINVAL if an argument is greater than
* current_time + 100,000,000. So cut up to 100,000,000. This is
* considered as a kind of spurious wakeup. The caller to native_sleep
* should care about spurious wakeup.
*
* See also [Bug #1341] [ruby-core:29702]
* http://download.oracle.com/docs/cd/E19683-01/816-0216/6m6ngupgv/index.html
*/
if (timeout_rel.tv_sec > 100000000) {
timeout_rel.tv_sec = 100000000;
timeout_rel.tv_nsec = 0;
}
timeout = native_cond_timeout(cond, timeout_rel);
}