Use spin lock operations on sigstate lock.

Don't expect _hurd_self_sigstate to lock it.
This commit is contained in:
Roland McGrath 1995-02-07 04:25:56 +00:00
parent 23afbf2338
commit 8548d4c084
2 changed files with 12 additions and 10 deletions

View File

@ -37,7 +37,8 @@ __sigreturn (struct sigcontext *scp)
return -1; return -1;
} }
ss = _hurd_self_sigstate (); /* SS->lock now locked. */ ss = _hurd_self_sigstate ();
__spin_lock (&ss->lock);
/* Restore the set of blocked signals, and the intr_port slot. */ /* Restore the set of blocked signals, and the intr_port slot. */
ss->blocked = scp->sc_mask; ss->blocked = scp->sc_mask;
@ -56,10 +57,10 @@ __sigreturn (struct sigcontext *scp)
the SCP context is doing an interruptible RPC, but the signal the SCP context is doing an interruptible RPC, but the signal
thread will examine us while we are blocked in the sig_post RPC. */ thread will examine us while we are blocked in the sig_post RPC. */
ss->intr_port = MACH_PORT_NULL; ss->intr_port = MACH_PORT_NULL;
__mutex_unlock (&ss->lock); __spin_unlock (&ss->lock);
__sig_post (_hurd_msgport, 0, __mach_task_self ()); __msg_sig_post (_hurd_msgport, 0, __mach_task_self ());
/* If a pending signal was handled, sig_post never returned. */ /* If a pending signal was handled, sig_post never returned. */
__mutex_lock (&ss->lock); __spin_lock (&ss->lock);
} }
if (scp->sc_onstack) if (scp->sc_onstack)
@ -69,7 +70,7 @@ __sigreturn (struct sigcontext *scp)
abort (); abort ();
} }
else else
__mutex_unlock (&ss->lock); __spin_unlock (&ss->lock);
/* Destroy the MiG reply port used by the signal handler, and restore the /* Destroy the MiG reply port used by the signal handler, and restore the
reply port in use by the thread when interrupted. */ reply port in use by the thread when interrupted. */

View File

@ -33,7 +33,8 @@ __sigreturn (struct sigcontext *scp)
return -1; return -1;
} }
ss = _hurd_self_sigstate (); /* SS->lock now locked. */ ss = _hurd_self_sigstate ();
__spin_lock (&ss->lock);
/* Restore the set of blocked signals, and the intr_port slot. */ /* Restore the set of blocked signals, and the intr_port slot. */
ss->blocked = scp->sc_mask; ss->blocked = scp->sc_mask;
@ -52,10 +53,10 @@ __sigreturn (struct sigcontext *scp)
the SCP context is doing an interruptible RPC, but the signal the SCP context is doing an interruptible RPC, but the signal
thread will examine us while we are blocked in the sig_post RPC. */ thread will examine us while we are blocked in the sig_post RPC. */
ss->intr_port = MACH_PORT_NULL; ss->intr_port = MACH_PORT_NULL;
__mutex_unlock (&ss->lock); __spin_unlock (&ss->lock);
__sig_post (_hurd_msgport, 0, __mach_task_self ()); __msg_sig_post (_hurd_msgport, 0, __mach_task_self ());
/* If a pending signal was handled, sig_post never returned. */ /* If a pending signal was handled, sig_post never returned. */
__mutex_lock (&ss->lock); __spin_lock (&ss->lock);
} }
if (scp->sc_onstack) if (scp->sc_onstack)
@ -65,7 +66,7 @@ __sigreturn (struct sigcontext *scp)
abort (); abort ();
} }
else else
__mutex_unlock (&ss->lock); __spin_unlock (&ss->lock);
/* Destroy the MiG reply port used by the signal handler, and restore the /* Destroy the MiG reply port used by the signal handler, and restore the
reply port in use by the thread when interrupted. */ reply port in use by the thread when interrupted. */