diff options
| author | Daniel Eischen <deischen@FreeBSD.org> | 2003-04-18 05:04:16 +0000 | 
|---|---|---|
| committer | Daniel Eischen <deischen@FreeBSD.org> | 2003-04-18 05:04:16 +0000 | 
| commit | a0240e2cb0b1ef8e5b61930ac2b850c884daaba8 (patch) | |
| tree | 46bc1e113ddc7c1ed88e4fa724039df8664c963a /lib/libpthread/thread/thr_kill.c | |
| parent | b025fc9a31c85b9cde9969e1fea55ea4caf650d5 (diff) | |
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_kill.c')
| -rw-r--r-- | lib/libpthread/thread/thr_kill.c | 22 | 
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/libpthread/thread/thr_kill.c b/lib/libpthread/thread/thr_kill.c index 24f9150d7136..19f34bb4396b 100644 --- a/lib/libpthread/thread/thr_kill.c +++ b/lib/libpthread/thread/thr_kill.c @@ -41,8 +41,26 @@ __weak_reference(_pthread_kill, pthread_kill);  int  _pthread_kill(pthread_t pthread, int sig)  { +	struct pthread *curthread = _get_curthread(); +	int ret; + +	/* Check for invalid signal numbers: */ +	if (sig < 0 || sig >= NSIG) +		/* Invalid signal: */ +		ret = EINVAL;  	/* -	 * All signals are unsupported. +	 * Ensure the thread is in the list of active threads, and the +	 * signal is valid (signal 0 specifies error checking only) and +	 * not being ignored:  	 */ -	return (EINVAL); +	else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0)) +	    == 0) { +		if ((sig > 0) && +		    (_thread_sigact[sig - 1].sa_handler != SIG_IGN)) +			_thr_sig_send(pthread, sig); +		_thr_ref_delete(curthread, pthread); +	} + +	/* Return the completion status: */ +	return (ret);  }  | 
