mirror of
https://github.com/fluencelabs/musl
synced 2025-06-05 02:51:40 +00:00
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 83dc6eb087633abcf5608ad651d3b525ca2ec35e documents the rationale for this change, and in particular why the tgkill syscall is useless for its designed purpose of avoiding races.
16 lines
269 B
C
16 lines
269 B
C
#include <signal.h>
|
|
#include <stdint.h>
|
|
#include "syscall.h"
|
|
#include "pthread_impl.h"
|
|
|
|
int raise(int sig)
|
|
{
|
|
int tid, ret;
|
|
sigset_t set;
|
|
__block_app_sigs(&set);
|
|
tid = __syscall(SYS_gettid);
|
|
ret = syscall(SYS_tkill, tid, sig);
|
|
__restore_sigs(&set);
|
|
return ret;
|
|
}
|