volatile keyword in C++

The precise meaning of volatile is inherently machine dependent and can be understood only by reading the compiler documentation. Programs that use volatile usually must be changed when they are moved to new machines or compilers.
According to the C++11 ISO Standard, the volatile keyword is only meant for use for hardware access; do not use it for inter-thread communication. 
For inter-thread communication, the standard library provides std::atomic<T> templates.
```
#include <csignal>
#include <iostream>
using namespace std;

volatile sig_atomic_t gSignalStatus;

void signal_handler(int signal) {
  gSignalStatus = signal;
}

int main() {
  signal(SIGINT, signal_handler);

  cout << "SignalValue: " << gSignalStatus << endl;
  cout << "Sending signal " << SIGINT << endl;
  raise(SIGINT);
  cout << "SignalValue: " << gSignalStatus << endl;
}
```