aboutsummaryrefslogtreecommitdiffstats
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-28 05:59:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-28 05:59:13 +0000
commit50b17c701f0e49f09e8ae8faa924d87a99be9ce7 (patch)
tree79ae83de1611f6aea256b847ffcb0f881bad6f9d /thread_pthread.c
parente6ece12201b464a7236f8117bfd152e7ff12ba46 (diff)
downloadruby-50b17c701f0e49f09e8ae8faa924d87a99be9ce7.tar.gz
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
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index b66273520a..8fb510e0e4 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -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;
}
}