mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* thread.c (rb_mutex_unlock_th): simplified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8032371462
commit
6b1bae9641
2 changed files with 7 additions and 16 deletions
|
@ -1,4 +1,6 @@
|
||||||
Fri Jan 13 18:25:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Jan 13 18:29:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* thread.c (rb_mutex_unlock_th): simplified.
|
||||||
|
|
||||||
* thread.c (rb_barrier_waiting): fix potential overflows.
|
* thread.c (rb_barrier_waiting): fix potential overflows.
|
||||||
|
|
||||||
|
|
19
thread.c
19
thread.c
|
@ -3523,7 +3523,6 @@ static const char *
|
||||||
rb_mutex_unlock_th(rb_mutex_t *mutex, rb_thread_t volatile *th)
|
rb_mutex_unlock_th(rb_mutex_t *mutex, rb_thread_t volatile *th)
|
||||||
{
|
{
|
||||||
const char *err = NULL;
|
const char *err = NULL;
|
||||||
rb_mutex_t *th_mutex;
|
|
||||||
|
|
||||||
native_mutex_lock(&mutex->lock);
|
native_mutex_lock(&mutex->lock);
|
||||||
|
|
||||||
|
@ -3542,21 +3541,11 @@ rb_mutex_unlock_th(rb_mutex_t *mutex, rb_thread_t volatile *th)
|
||||||
native_mutex_unlock(&mutex->lock);
|
native_mutex_unlock(&mutex->lock);
|
||||||
|
|
||||||
if (!err) {
|
if (!err) {
|
||||||
th_mutex = th->keeping_mutexes;
|
rb_mutex_t *volatile *th_mutex = &th->keeping_mutexes;
|
||||||
if (th_mutex == mutex) {
|
while (*th_mutex != mutex) {
|
||||||
th->keeping_mutexes = mutex->next_mutex;
|
th_mutex = &(*th_mutex)->next_mutex;
|
||||||
}
|
|
||||||
else {
|
|
||||||
while (1) {
|
|
||||||
rb_mutex_t *tmp_mutex;
|
|
||||||
tmp_mutex = th_mutex->next_mutex;
|
|
||||||
if (tmp_mutex == mutex) {
|
|
||||||
th_mutex->next_mutex = tmp_mutex->next_mutex;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
th_mutex = tmp_mutex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
*th_mutex = mutex->next_mutex;
|
||||||
mutex->next_mutex = NULL;
|
mutex->next_mutex = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue