Correct a race condition where it was possible for a signaled
thread to become stranded and not placed in the run queue. MFC Candidate Reported by: tegge
This commit is contained in:
parent
8080165a1b
commit
0d4935c84e
@ -569,9 +569,9 @@ thread_sig_handle_special(int sig)
|
||||
static void
|
||||
thread_sig_add(pthread_t pthread, int sig, int has_args)
|
||||
{
|
||||
struct pthread *curthread = _get_curthread();
|
||||
int restart;
|
||||
int suppress_handler = 0;
|
||||
int thread_is_active = 0;
|
||||
|
||||
restart = _thread_sigact[sig - 1].sa_flags & SA_RESTART;
|
||||
|
||||
@ -604,6 +604,12 @@ thread_sig_add(pthread_t pthread, int sig, int has_args)
|
||||
*/
|
||||
if ((pthread->flags & PTHREAD_FLAGS_IN_PRIOQ) != 0)
|
||||
PTHREAD_PRIOQ_REMOVE(pthread);
|
||||
else
|
||||
/*
|
||||
* This thread is running; avoid placing it in
|
||||
* the run queue:
|
||||
*/
|
||||
thread_is_active = 1;
|
||||
break;
|
||||
|
||||
case PS_SUSPENDED:
|
||||
@ -753,7 +759,7 @@ thread_sig_add(pthread_t pthread, int sig, int has_args)
|
||||
* the thread in the run queue.
|
||||
*/
|
||||
pthread->active_priority |= PTHREAD_SIGNAL_PRIORITY;
|
||||
if (pthread != curthread)
|
||||
if (thread_is_active == 0)
|
||||
PTHREAD_PRIOQ_INSERT_TAIL(pthread);
|
||||
}
|
||||
}
|
||||
|
@ -569,9 +569,9 @@ thread_sig_handle_special(int sig)
|
||||
static void
|
||||
thread_sig_add(pthread_t pthread, int sig, int has_args)
|
||||
{
|
||||
struct pthread *curthread = _get_curthread();
|
||||
int restart;
|
||||
int suppress_handler = 0;
|
||||
int thread_is_active = 0;
|
||||
|
||||
restart = _thread_sigact[sig - 1].sa_flags & SA_RESTART;
|
||||
|
||||
@ -604,6 +604,12 @@ thread_sig_add(pthread_t pthread, int sig, int has_args)
|
||||
*/
|
||||
if ((pthread->flags & PTHREAD_FLAGS_IN_PRIOQ) != 0)
|
||||
PTHREAD_PRIOQ_REMOVE(pthread);
|
||||
else
|
||||
/*
|
||||
* This thread is running; avoid placing it in
|
||||
* the run queue:
|
||||
*/
|
||||
thread_is_active = 1;
|
||||
break;
|
||||
|
||||
case PS_SUSPENDED:
|
||||
@ -753,7 +759,7 @@ thread_sig_add(pthread_t pthread, int sig, int has_args)
|
||||
* the thread in the run queue.
|
||||
*/
|
||||
pthread->active_priority |= PTHREAD_SIGNAL_PRIORITY;
|
||||
if (pthread != curthread)
|
||||
if (thread_is_active == 0)
|
||||
PTHREAD_PRIOQ_INSERT_TAIL(pthread);
|
||||
}
|
||||
}
|
||||
|
@ -569,9 +569,9 @@ thread_sig_handle_special(int sig)
|
||||
static void
|
||||
thread_sig_add(pthread_t pthread, int sig, int has_args)
|
||||
{
|
||||
struct pthread *curthread = _get_curthread();
|
||||
int restart;
|
||||
int suppress_handler = 0;
|
||||
int thread_is_active = 0;
|
||||
|
||||
restart = _thread_sigact[sig - 1].sa_flags & SA_RESTART;
|
||||
|
||||
@ -604,6 +604,12 @@ thread_sig_add(pthread_t pthread, int sig, int has_args)
|
||||
*/
|
||||
if ((pthread->flags & PTHREAD_FLAGS_IN_PRIOQ) != 0)
|
||||
PTHREAD_PRIOQ_REMOVE(pthread);
|
||||
else
|
||||
/*
|
||||
* This thread is running; avoid placing it in
|
||||
* the run queue:
|
||||
*/
|
||||
thread_is_active = 1;
|
||||
break;
|
||||
|
||||
case PS_SUSPENDED:
|
||||
@ -753,7 +759,7 @@ thread_sig_add(pthread_t pthread, int sig, int has_args)
|
||||
* the thread in the run queue.
|
||||
*/
|
||||
pthread->active_priority |= PTHREAD_SIGNAL_PRIORITY;
|
||||
if (pthread != curthread)
|
||||
if (thread_is_active == 0)
|
||||
PTHREAD_PRIOQ_INSERT_TAIL(pthread);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user