title: How can I write cross platform c++ that handles signals?
body: <p>This question is more for my personal curiosity than anything important. I'm trying to keep all my code compatible with at least Windows and Mac. So far I've learned that I should base my code on POSIX and that's just great but...</p>
  
  <p>Windows doesn't have a <code>sigaction</code> function so <code>signal</code> is used? According to:
  <a href="https://stackoverflow.com/questions/231912/what-is-the-difference-between-sigaction-and-signal">What is the difference between sigaction and signal?</a> there are some problems with signal.</p>
  
  <blockquote>
    <ol>
    <li>The signal() function does not block other signals from arriving while the current handler is executing; sigaction() can block other signals until the current handler returns.</li>
    <li>The signal() function resets the signal action back to SIG_DFL (default) for almost all signals. This means that the signal() handler must reinstall itself as its first action. It also opens up a window of vulnerability between the time when the signal is detected and the handler is reinstalled during which if a second instance of the signal arrives, the default behaviour (usually terminate, sometimes with prejudice - aka core dump) occurs.</li>
    </ol>
  </blockquote>
  
  <p>If two SIGINT's come quickly then the application will terminate with default behavior. Is there any way to fix this behavior? What other implications do these two issues have on a process that, for instance wants to block SIGINT? Are there any other issues that I'm likely to run across while using signal? How do I fix them?</p>