ManualResetEvent 讓你的代碼等你幾分鐘

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;spa

namespace ConsoleApp
{
class Program
{
public delegate void RunSomething();
static ManualResetEvent manualEvn = new ManualResetEvent(true);
static void Main(string[] args)
{
RunSomething run = new RunSomething(Do);string

manualEvn.Reset();it

run.BeginInvoke(r =>
{
run.EndInvoke(r);io

}, null);class

bool bl = manualEvn.WaitOne(10 * 1000);static

}di


public static void Do()
{
Thread.Sleep(15 * 1000);new

manualEvn.Set();
}
}
}void

相關文章
相關標籤/搜索