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);

 

你可能感兴趣的:(多线程)