Worker thread vs BeginInvoke?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jon Pope

    #1

    Worker thread vs BeginInvoke?

    What is the difference between firing off a method via BeginInvoke, and
    running code on a worker thread? Based on the documentation, it would
    appear that the asynchronous call created with BeginInvoke does the same
    thing as a worker thread, but the async call runs in the UI thread.

    Cheers, Jon


  • Jon Skeet [C# MVP]

    #2
    Re: Worker thread vs BeginInvoke?

    Jon Pope <jon.pope@healt hlinkinc.com> wrote:[color=blue]
    > What is the difference between firing off a method via BeginInvoke, and
    > running code on a worker thread? Based on the documentation, it would
    > appear that the asynchronous call created with BeginInvoke does the same
    > thing as a worker thread, but the async call runs in the UI thread.[/color]

    Which BeginInvoke do you mean? If you mean a delegate call, the work is
    done on a thread pool thread. If you mean Control.BeginIn voke, the work
    is done on the UI thread, which is important for UI work where you
    *must* use the UI thread if you touch any controls.

    --
    Jon Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    Working...