Add sig_intr(9).
It gives the answer would the thread sleep according to current state of signals and suspensions. Of course the answer is racy and allows for false-negatives (no sleep when signal is delivered after process lock is dropped). Also the answer might change due to signal rescheduling among threads in multi-threaded process. Still it is the best approximation I can provide, to answering the question was the thread interrupted. Reviewed by: markj Tested by: pho, rmacklem Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D26628
This commit is contained in:
parent
488a29c7f2
commit
e42c608b41
@ -3204,6 +3204,24 @@ sig_ast_needsigchk(struct thread *td)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
int
|
||||
sig_intr(void)
|
||||
{
|
||||
struct thread *td;
|
||||
struct proc *p;
|
||||
int ret;
|
||||
|
||||
td = curthread;
|
||||
p = td->td_proc;
|
||||
|
||||
PROC_LOCK(p);
|
||||
ret = sig_ast_checksusp(td);
|
||||
if (ret == 0)
|
||||
ret = sig_ast_needsigchk(td);
|
||||
PROC_UNLOCK(p);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
void
|
||||
proc_wkilled(struct proc *p)
|
||||
{
|
||||
|
@ -408,6 +408,7 @@ int sig_ffs(sigset_t *set);
|
||||
void sigfastblock_clear(struct thread *td);
|
||||
void sigfastblock_fetch(struct thread *td);
|
||||
void sigfastblock_setpend(struct thread *td, bool resched);
|
||||
int sig_intr(void);
|
||||
void siginit(struct proc *p);
|
||||
void signotify(struct thread *td);
|
||||
void sigqueue_delete(struct sigqueue *queue, int sig);
|
||||
|
Loading…
Reference in New Issue
Block a user