]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd: Simplify _S_catch_exception_raise
authorSergey Bugaev <bugaevc@gmail.com>
Fri, 14 Apr 2023 19:36:59 +0000 (22:36 +0300)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 17 Apr 2023 23:20:46 +0000 (01:20 +0200)
_hurd_thread_sigstate () already handles finding an existing sigstate
before allocating a new one, so just use that. Bonus: this will only
lock the _hurd_siglock once.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
hurd/catch-exc.c

index 5ee2233aa9a2be2ae214160abc2838e6f9dd66e3..d375bf6789fbc9ecdd85e9b7c7ecec09a06c9db1 100644 (file)
@@ -58,13 +58,7 @@ _S_catch_exception_raise (mach_port_t port,
   _hurd_exception2signal (&d, &signo);
 
   /* Find the sigstate structure for the faulting thread.  */
-  __mutex_lock (&_hurd_siglock);
-  for (ss = _hurd_sigstates; ss != NULL; ss = ss->next)
-    if (ss->thread == thread)
-      break;
-  __mutex_unlock (&_hurd_siglock);
-  if (ss == NULL)
-    ss = _hurd_thread_sigstate (thread); /* Allocate a fresh one.  */
+  ss = _hurd_thread_sigstate (thread);
 
   if (__spin_lock_locked (&ss->lock))
     {