• r00ty@kbin.life
    link
    fedilink
    arrow-up
    3
    ·
    6 hours ago

    Here you go

    #include <iostream>
    #include <csignal>
    #include <unistd.h>
    
    void sigusr1_handler(int signal)
    {
    	std::cout << "Signal USR1" << std::endl;
    }
    
    int main()
    {
    	std::cout << "Installed handler for USR1" << std::endl;
    	std::signal(SIGUSR1, sigusr1_handler);
    	while (1 == 1)
    	{
    		usleep(5000000);	// 5 seconds
    		std::cout << "Waiting for signal" << std::endl;
    	}
    }
    

    That will help you read at least one of them.