ruby-changes:20361
From: mame <ko1@a...>
Date: Tue, 5 Jul 2011 01:32:29 +0900 (JST)
Subject: [ruby-changes:20361] mame:r32409 (trunk): * thread_pthread.c (native_sleep): cut the waiting time up to
mame 2011-07-05 01:32:21 +0900 (Tue, 05 Jul 2011) New Revision: 32409 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32409 Log: * 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. Modified files: trunk/ChangeLog trunk/thread_pthread.c Index: ChangeLog =================================================================== --- ChangeLog (revision 32408) +++ ChangeLog (revision 32409) @@ -1,3 +1,11 @@ +Tue Jul 5 01:30:01 2011 Yusuke Endoh <mame@t...> + + * 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@t...> * cont.c: disable FIBER_USE_NATIVE on Solaris because resuming any Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 32408) +++ thread_pthread.c (revision 32409) @@ -857,6 +857,19 @@ 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); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/