diff options
author | attilio <attilio@FreeBSD.org> | 2013-02-21 21:59:35 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2013-02-21 21:59:35 +0000 |
commit | d883da7ba4eb9b148404a424cba419d0b2289d47 (patch) | |
tree | 4cf4378c83ab287d8c742573abc4b47a685812ba /sys/kern/kern_sig.c | |
parent | 8702b26c682453a6988606aa821060803a997e25 (diff) | |
download | FreeBSD-src-d883da7ba4eb9b148404a424cba419d0b2289d47.zip FreeBSD-src-d883da7ba4eb9b148404a424cba419d0b2289d47.tar.gz |
MFC
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r-- | sys/kern/kern_sig.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 7d3634d..e1dbedc 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -2537,16 +2537,22 @@ tdsigcleanup(struct thread *td) } -/* Defer the delivery of SIGSTOP for the current thread. */ -void -sigdeferstop(struct thread *td) +/* + * Defer the delivery of SIGSTOP for the current thread. Returns true + * if stops were deferred and false if they were already deferred. + */ +int +sigdeferstop(void) { + struct thread *td; - KASSERT(!(td->td_flags & TDF_SBDRY), - ("attempt to set TDF_SBDRY recursively")); + td = curthread; + if (td->td_flags & TDF_SBDRY) + return (0); thread_lock(td); td->td_flags |= TDF_SBDRY; thread_unlock(td); + return (1); } /* @@ -2555,11 +2561,11 @@ sigdeferstop(struct thread *td) * will suspend either via ast() or a subsequent interruptible sleep. */ void -sigallowstop(struct thread *td) +sigallowstop() { + struct thread *td; - KASSERT(td->td_flags & TDF_SBDRY, - ("attempt to clear already-cleared TDF_SBDRY")); + td = curthread; thread_lock(td); td->td_flags &= ~TDF_SBDRY; thread_unlock(td); |