Skip to content

Instantly share code, notes, and snippets.

@hagbarddenstore
Created January 5, 2015 20:12
Show Gist options
  • Save hagbarddenstore/f1df01c96092fa73e47c to your computer and use it in GitHub Desktop.
Save hagbarddenstore/f1df01c96092fa73e47c to your computer and use it in GitHub Desktop.
public static class Program
{
private static readonly AutoResetEvent _event = new AutoResetEvent();
public static void Main()
{
Console.CancelKeyPress += (sender, arguments) =>
{
Console.WriteLine("Exiting...");
Thread.Sleep(5000);
_event.Set();
};
Console.WriteLine("Press Ctrl+C to exit...");
_event.WaitOne();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment