Make the minimum implementation of pthread_kill conform to the

functionality spelled out in SUSv3.
	o Signal of 0 means do everything except send the signal
	o Check that the signal is not invalid
	o Check that the target thread is not dead/invalid
This commit is contained in:
mtm 2004-03-29 13:56:04 +00:00
parent 7d2c70ccb6
commit 1e599449cf

View File

@ -75,9 +75,22 @@ __weak_reference(_pthread_kill, pthread_kill);
int
_pthread_kill(pthread_t pthread, int sig)
{
int error;
if (sig < 0 || sig > NSIG)
return (EINVAL);
if (_thread_initial == NULL)
_thread_init();
error = _find_thread(pthread);
if (error != 0)
return (error);
/*
* A 0 signal means do error-checking but don't send signal.
*/
if (sig == 0)
return (0);
return (thr_kill(pthread->thr_id, sig));
}