Skip to content

Commit

Permalink
Implement raise
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtriplett committed Jan 4, 2025
1 parent e6160a7 commit aca8e66
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,17 @@ pub unsafe fn tgkill(tid: Pid, sig: Signal) -> io::Result<()> {
backend::runtime::syscalls::tgkill(tid, sig)
}

/// `raise(sig)`—Send a signal to the current thread.
///
/// # References
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man3/raise.3.html
#[inline]
pub fn raise(sig: Signal) -> io::Result<()> {
// SAFETY: This sends a signal to the current thread, and our own thread ID can't be recycled.
unsafe { backend::runtime::syscalls::tkill(backend::thread::syscalls::gettid(), sig) }
}

/// `rt_sigprocmask(how, set, oldset)`—Adjust the process signal mask.
///
Expand Down

0 comments on commit aca8e66

Please sign in to comment.