ManualResetEvent set waitone
static void ManualResetEventFalseReset() { var signal = new ManualResetEvent(false); int x = 10; PrintLine(); new Thread(() => { PrintLine(); x++; Thread.Sleep(1000); PrintLine(); signal.Set(); }).Start(); PrintLine(); Thread.Sleep(1000); PrintLine(); signal.WaitOne(); PrintLine(); Console.WriteLine(x); } static void PrintLine([CallerLineNumber] int lineNum=0) { Console.WriteLine($"{DateTime.Now.ToString("O")},line:{lineNum}"); } static void Main(string[] args) { ManualResetEventFalseReset(); LogInfo(); }