ruby-changes:19335
From: kosaki <ko1@a...>
Date: Fri, 29 Apr 2011 10:22:37 +0900 (JST)
Subject: [ruby-changes:19335] Ruby:r31375 (trunk): * thread.c (lock_func): small cleanup.
kosaki 2011-04-29 10:18:11 +0900 (Fri, 29 Apr 2011) New Revision: 31375 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31375 Log: * thread.c (lock_func): small cleanup. Modified files: trunk/ChangeLog trunk/thread.c Index: ChangeLog =================================================================== --- ChangeLog (revision 31374) +++ ChangeLog (revision 31375) @@ -1,3 +1,7 @@ +Fri Apr 29 10:17:42 2011 KOSAKI Motohiro <kosaki.motohiro@g...> + + * thread.c (lock_func): small cleanup. + Fri Apr 29 10:07:13 2011 KOSAKI Motohiro <kosaki.motohiro@g...> * thread.c (rb_mutex_lock, lock_func): Avoid busy loop and Index: thread.c =================================================================== --- thread.c (revision 31374) +++ thread.c (revision 31375) @@ -3235,10 +3235,15 @@ native_mutex_lock(&mutex->lock); th->transition_for_lock = 0; - while (mutex->th || (mutex->th = th, 0)) { + for (;;) { struct timespec ts; int ret; + if (!mutex->th) { + mutex->th = th; + break; + } + mutex->cond_waiting++; if (timeout_ms) { ts = init_lock_timeout(timeout_ms); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/