зеркало из https://github.com/github/ruby.git
thread_pthread.c: simplify
* thread_pthread.c (register_cached_thread_and_wait): simplify and reduce branches. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
e6ece12201
Коммит
50b17c701f
|
@ -801,21 +801,14 @@ register_cached_thread_and_wait(void)
|
|||
native_cond_timedwait(&cond, &thread_cache_lock, &ts);
|
||||
|
||||
{
|
||||
struct cached_thread_entry *e = cached_thread_root;
|
||||
struct cached_thread_entry *prev = cached_thread_root;
|
||||
struct cached_thread_entry *e, **prev = &cached_thread_root;
|
||||
|
||||
while (e) {
|
||||
while ((e = *prev) != 0) {
|
||||
if (e == entry) {
|
||||
if (prev == cached_thread_root) {
|
||||
cached_thread_root = e->next;
|
||||
}
|
||||
else {
|
||||
prev->next = e->next;
|
||||
}
|
||||
*prev = e->next;
|
||||
break;
|
||||
}
|
||||
prev = e;
|
||||
e = e->next;
|
||||
prev = &e->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче