Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 9270
b: refs/heads/master
c: 188a1ea
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Sep 23, 2005
1 parent 33ddec1 commit fce260a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ede1327ea4ca8019ec6df24b3e837def091c26b8
refs/heads/master: 188a1eafa03aaa5e5fe6f53e637e704cd2c31c7c
31 changes: 14 additions & 17 deletions trunk/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,34 +936,31 @@ force_sig_specific(int sig, struct task_struct *t)
* as soon as they're available, so putting the signal on the shared queue
* will be equivalent to sending it to one such thread.
*/
#define wants_signal(sig, p, mask) \
(!sigismember(&(p)->blocked, sig) \
&& !((p)->state & mask) \
&& !((p)->flags & PF_EXITING) \
&& (task_curr(p) || !signal_pending(p)))

static inline int wants_signal(int sig, struct task_struct *p)
{
if (sigismember(&p->blocked, sig))
return 0;
if (p->flags & PF_EXITING)
return 0;
if (sig == SIGKILL)
return 1;
if (p->state & (TASK_STOPPED | TASK_TRACED))
return 0;
return task_curr(p) || !signal_pending(p);
}

static void
__group_complete_signal(int sig, struct task_struct *p)
{
unsigned int mask;
struct task_struct *t;

/*
* Don't bother traced and stopped tasks (but
* SIGKILL will punch through that).
*/
mask = TASK_STOPPED | TASK_TRACED;
if (sig == SIGKILL)
mask = 0;

/*
* Now find a thread we can wake up to take the signal off the queue.
*
* If the main thread wants the signal, it gets first crack.
* Probably the least surprising to the average bear.
*/
if (wants_signal(sig, p, mask))
if (wants_signal(sig, p))
t = p;
else if (thread_group_empty(p))
/*
Expand All @@ -981,7 +978,7 @@ __group_complete_signal(int sig, struct task_struct *p)
t = p->signal->curr_target = p;
BUG_ON(t->tgid != p->tgid);

while (!wants_signal(sig, t, mask)) {
while (!wants_signal(sig, t)) {
t = next_thread(t);
if (t == p->signal->curr_target)
/*
Expand Down

0 comments on commit fce260a

Please sign in to comment.