转载

4.0多线程用法

  HttpContext currentContext = System.Web.HttpContext.Current;
             

                Task aa= Task.Factory.StartNew(state =>
                {
                    System.Web.HttpContext.Current = (HttpContext)state;
                     +++++code
                }, currentContext);

                Task bb= Task.Factory.StartNew(state =>
                {
                    System.Web.HttpContext.Current = (HttpContext)state;
                   ++++++code
                }, currentContext);

                Task[] taskCollection = new Task[2] { aa, bb};
                Task.WaitAll(taskCollection);

 

转载于:https://www.cnblogs.com/fang-beny/p/3338602.html

正文到此结束
本文目录