提交 7d351212 编写于 作者: R Rich Felker

use tkill instead of tgkill in implementing raise

this shaves off a useless syscall for getting the caller's pid and
brings raise into alignment with other functions which were adapted to
use tkill rather than tgkill.

commit 83dc6eb0 documents the
rationale for this change, and in particular why the tgkill syscall is
useless for its designed purpose of avoiding races.
上级 0f859fc9
......@@ -5,12 +5,11 @@
int raise(int sig)
{
int pid, tid, ret;
int tid, ret;
sigset_t set;
__block_app_sigs(&set);
tid = __syscall(SYS_gettid);
pid = __syscall(SYS_getpid);
ret = syscall(SYS_tgkill, pid, tid, sig);
ret = syscall(SYS_tkill, tid, sig);
__restore_sigs(&set);
return ret;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册