Does a new thread is created while function callback ? RRS feed

  • Question

  • Hello,

    does function callback e.g., handling events or any web service call from client side in browser create a new thread of execution ?

    Wednesday, August 31, 2011 4:25 PM


  • Typically, no.  That being said, many "callbacks" or events get raised on a different thread than the one which was used during the subscription, but this completely depends on the event.  However, even if a different thread is used, it's typically a ThreadPool thread, so it's not "creating" a new thread.


    It really depends on the method being used, though.  Most asynchronous operations (ie: calling a web service asynchronously) will use a ThreadPool thread when the XXXComplete event is raised.  However, many UI events are guaranteed to execute on the user interface thread, as they're in response to a message processed on the UI thread.  Timer events (System.Timers.Timer or System.Threading.Timer) will happen on a ThreadPool thread....

    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Proposed as answer by Andreas Johansson Wednesday, August 31, 2011 6:12 PM
    • Marked as answer by Paul Zhou Thursday, September 8, 2011 9:48 AM
    Wednesday, August 31, 2011 4:44 PM