none
Threadpool v/s Task classes RRS feed

  • Question

  • Hi All,

    I have three work items which has to be run parallelly, i am using follwoing code to perform three work items as shown below , this work items are unstoppable

    XYZMethod()

    {

    ThreadPool.QueueUserWorkItem(new WaitCallback(ValidateInformation));

     ThreadPool.QueueUserWorkItem(new WaitCallback(Traceprocessing));

     ThreadPool.QueueUserWorkItem(new WaitCallback(SendMessage));

    }

    OnElapsedTime()

    {

    XYZMethod();

    }

    The OnElapsedTime is called every one minute using Timer class. 

    This code was developed while we are running with .NET 3.5 , but now we have upgraded to 4.0 . Now my question is how can i replace Threadpool with  Task classes.

    As i am new to the TPL , Please help on this issue.

    Thansk in advance

    Mounesh

    Wednesday, October 25, 2017 6:24 AM

All replies