hurd: Simplify _S_catch_exception_raise

_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>
This commit is contained in:
Sergey Bugaev 2023-04-14 22:36:59 +03:00 committed by Samuel Thibault
parent 346b6eab3c
commit 45000f1231

View File

@ -58,13 +58,7 @@ _S_catch_exception_raise (mach_port_t port,
_hurd_exception2signal (&d, &signo); _hurd_exception2signal (&d, &signo);
/* Find the sigstate structure for the faulting thread. */ /* Find the sigstate structure for the faulting thread. */
__mutex_lock (&_hurd_siglock); ss = _hurd_thread_sigstate (thread);
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. */
if (__spin_lock_locked (&ss->lock)) if (__spin_lock_locked (&ss->lock))
{ {