* thread.c (lock_func): small cleanup.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
32ae0ae1c2
commit
6998f013ab
@ -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>
|
Fri Apr 29 10:07:13 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
* thread.c (rb_mutex_lock, lock_func): Avoid busy loop and
|
* thread.c (rb_mutex_lock, lock_func): Avoid busy loop and
|
||||||
|
7
thread.c
7
thread.c
@ -3235,10 +3235,15 @@ lock_func(rb_thread_t *th, mutex_t *mutex, int timeout_ms)
|
|||||||
|
|
||||||
native_mutex_lock(&mutex->lock);
|
native_mutex_lock(&mutex->lock);
|
||||||
th->transition_for_lock = 0;
|
th->transition_for_lock = 0;
|
||||||
while (mutex->th || (mutex->th = th, 0)) {
|
for (;;) {
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (!mutex->th) {
|
||||||
|
mutex->th = th;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
mutex->cond_waiting++;
|
mutex->cond_waiting++;
|
||||||
if (timeout_ms) {
|
if (timeout_ms) {
|
||||||
ts = init_lock_timeout(timeout_ms);
|
ts = init_lock_timeout(timeout_ms);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user