We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
raise
1 parent e6160a7 commit d8540daCopy full SHA for d8540da
src/runtime.rs
@@ -450,6 +450,17 @@ pub unsafe fn tgkill(tid: Pid, sig: Signal) -> io::Result<()> {
450
backend::runtime::syscalls::tgkill(tid, sig)
451
}
452
453
+/// `raise(sig)`—Send a signal to the current thread.
454
+///
455
+/// # References
456
+/// - [Linux]
457
458
+/// [Linux]: https://man7.org/linux/man-pages/man3/raise.3.html
459
+#[inline]
460
+pub fn raise(sig: Signal) -> io::Result<()> {
461
+ // SAFETY: This sends a signal to the current thread, and our own thread ID can't be recycled.
462
+ unsafe { backend::runtime::syscalls::tkill(backend::runtime::syscalls::gettid(), sig) }
463
+}
464
465
/// `rt_sigprocmask(how, set, oldset)`—Adjust the process signal mask.
466
///
0 commit comments