title: is it possible to resume the interrupted process after getting SIGTERM singal?
body: <p>In below program, What I am trying to achieve is when I press Ctrl+C or give SIGTERM then I want to make 'isEnable' false and let the while loop finish executing it's code one last time and exit the program gracefully.
  I can achieve this only with CancelKeyPress because EventArgs passed on this handler has Cancel property and I just need to set it true. And, CancelKeyPress only handle Ctrl+C. But, I want same thing when I got SIGTERM signal.</p>
  <p>Does anyone know is it possible to resuming the process after getting SIGTERM signal just like in CancelKeyPress?</p>
  <p>Please let me know if you need more information to understand my question.</p>
  <pre><code>class Program
      {
          static void Main(string[] args)
          {
              Console.WriteLine(&quot;Hello World!&quot;);
  
              bool isEnable = true;
  
              Console.CancelKeyPress += (s, e) =&gt;
              {
                  e.Cancel = true;
                  isEnable = false; // making while loop false
                  Console.WriteLine(&quot;Inside CancelKeyPress&quot;);
              };
  
              AppDomain.CurrentDomain.ProcessExit += (s, e) =&gt;
              {
                  isEnable = false;  // making while loop false
                  Console.WriteLine(&quot;AppDomain ProcessExit!&quot;);
              };
  
              while (isEnable)
              {
                  Console.WriteLine(&quot;first&quot;);
                  Thread.Sleep(3000);
                  Console.WriteLine(&quot;Second&quot;);
                  Thread.Sleep(3000);
                  Console.WriteLine(&quot;Third&quot;);
                  Thread.Sleep(3000);
                  Console.WriteLine(&quot;Fourth&quot;);
                  Thread.Sleep(3000);
              }
  
              Console.WriteLine(&quot;Gracefull Shotdown&quot;);
  
          }
      }
  </code></pre>