aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/exceptions.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-12-07 03:27:51 +0000
committerChristopher Faylor <me@cgf.cx>2003-12-07 03:27:51 +0000
commitae2543ed76f3271061bffc0549961aa74baba64f (patch)
tree2e342d323ba7fea34985fed87c67a44332ab7aad /winsup/cygwin/exceptions.cc
parent73262d7a44b90e2338fe031ebeaa17c7a299d547 (diff)
downloadnewlib-ae2543ed76f3271061bffc0549961aa74baba64f.zip
newlib-ae2543ed76f3271061bffc0549961aa74baba64f.tar.gz
newlib-ae2543ed76f3271061bffc0549961aa74baba64f.tar.bz2
* exceptions.cc (_threadinfo::remove): Avoid a linked list walk.
Diffstat (limited to 'winsup/cygwin/exceptions.cc')
-rw-r--r--winsup/cygwin/exceptions.cc16
1 files changed, 7 insertions, 9 deletions
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index ea2c7e6..feb3632 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -188,17 +188,15 @@ _threadinfo::init_thread (void *)
void
_threadinfo::remove ()
{
- _threadinfo *t;
EnterCriticalSection (&protect_linked_list);
- for (t = _last_thread; t && t != this; t = t->prev)
- continue;
- if (t)
+ if (prev)
{
- t->prev->next = t->next;
- if (t->next)
- t->next->prev = t->prev;
- if (t == _last_thread)
- _last_thread = t->prev;
+ prev->next = next;
+ if (next)
+ next->prev = prev;
+ if (this == _last_thread)
+ _last_thread = prev;
+ prev = next = NULL;
}
LeaveCriticalSection (&protect_linked_list);
}