Skip to content

Instantly share code, notes, and snippets.

@smallpine
smallpine / ConsoleAppWzKillSwitch.cs
Last active August 29, 2015 14:06
Console Application with Kill switch
internal class Program
{
private const string MUTEX_NAME = "Global\\__KILL_SWITCH__";
private static Semaphore StopSignal;
private static readonly ILog Logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
internal static void Main(string[] args)
{
// コマンドライン引数に「/KILL」が指定されたときは、先に起動しているプロセスを終了させます。
if (args.Length > 0 && "/KILL".Equals(args[0].ToUpper()))