标签:阻塞 ref 异步 result tps log http sdn syn
https://blog.csdn.net/xiawu1990/article/details/78350253?utm_source=blogxgwz7
var t = Task.Run(async delegate
{
await Task.Delay(5000);
Console.WriteLine("5秒后会执行此输出语句");
return 42;
});
Console.WriteLine("此输出语句立马执行");
t.Wait();
Console.WriteLine("Task t Status: {0}, Result: {1}", t.Status, t.Result);
Console.ReadLine();
慎用thread.sleep(),会线程阻塞,等待期间什么也干不了,相当于程序死了。
标签:阻塞 ref 异步 result tps log http sdn syn
原文地址:https://www.cnblogs.com/wsq-blog/p/10661433.html