diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-04-29 01:18:11 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-04-29 01:18:11 +0000 |
commit | 6998f013ab594d3f2499155b1076e45eedf70e34 (patch) | |
tree | 6ea375bf09402977280c5bb4878d779ef3b79d69 | |
parent | 32ae0ae1c2d6b1d24a875e2846db11290907a11f (diff) | |
download | ruby-6998f013ab594d3f2499155b1076e45eedf70e34.tar.gz |
* thread.c (lock_func): small cleanup.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | thread.c | 7 |
2 files changed, 10 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Fri Apr 29 10:17:42 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com> + + * thread.c (lock_func): small cleanup. + Fri Apr 29 10:07:13 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com> * thread.c (rb_mutex_lock, lock_func): Avoid busy loop and @@ -3235,10 +3235,15 @@ lock_func(rb_thread_t *th, mutex_t *mutex, int timeout_ms) 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); |