std::raise(3)
πΈ NAME πΈ
std::raise - std::raise β yes bestie, the function is so nice they named it twice β¨. This page comes from the C++ Standard Libary (and yes, the header really spells it like that β iconic typo, no notes π), and weβre about to send some signals, okay? π
π¦ Synopsis π¦
Defined in header <csignal>
int raise( int sig );
Sends signal sig to the program. The signal handler β the one you specify with the std::signal() function β gets invoked. π«Ά
If you havenβt set a user-defined signal handling strategy using std::signal() yet, it is implementation-defined whether the signal will be ignored or the default handler will be invoked. Like, the standard is literally not promising you which one, so donβt act surprised π.
π Parameters π
sig β the signal to be sent. It can be an implementation-defined value or one of the following values:
SIGABRTSIGFPESIGILLSIGINTSIGSEGVSIGTERM
These are macro constants that define signal types. Slay, constants π.
β¨ Return value β¨
0 upon success, non-zero value on failure. Thatβs it, thatβs the vibe check π₯.
π Example π
// Run this code
#include <csignal>
#include <iostream>
void signal_handler(int signal)
{
std::cout << "Received signal " << signal << '\n';
}
int main()
{
// Install a signal handler
std::signal(SIGTERM, signal_handler);
std::cout << "Sending signal " << SIGTERM << '\n';
std::raise(SIGTERM);
}
π Possible output π
Sending signal 15
Received signal 15
π See also π
signalβ sets a signal handler for particular signal (function)- C documentation for
raise
source: http://cppreference.com Β· version/date: 2024.06.10 Β· std::raise(3) signing off, love u bestie ππ«Άπ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms