Check out example codes for "launch function with signal c++". It will help you in understanding the concepts better.

Code Example 1

#include <iostream>
#include <csignal>
using namespace std;

sig_atomic_t signalled = 0;

void handler(int sig)
    signalled = 1;

int main()
    signal(SIGINT, handler);
    if (signalled)
        cout << "Signal is handled";
        cout << "Signal is not handled";

    return 0;

Learn ReactJs, React Native from