Control.BeginInvoke(), which thread?

Discussion in 'Microsoft Dot NET' started by Grandma Wilkerson, Jun 25, 2003.

  1. My question concerns the documentation for Control.BeginInvoke(). At one
    point is says:

    "Executes the specified delegate asynchronously with the specified
    arguments, on the thread that the control's underlying handle was created
    on."

    later in that same documentation page it says...

    "Note The BeginInvoke method calls the specified delegate back on a
    different thread pool thread. You should not block a thread pool thread for
    any length of time."

    My impression was that when BeginInvoke is called on a control, the params
    are placed on the message queue of the UI thread [which created the control]
    and eventually the delegate representing the control's method is called *on
    the control's original UI thread*. Why does the documentation mention the
    thread pool? Why would a thread pool thread even be involved in this chain
    of events? I'm one confused granny.

    Granny
     
    Grandma Wilkerson, Jun 25, 2003
    #1
    1. Advertisements

  2. Grandma Wilkerson

    Bruce Brown Guest

    Hi,

    I cannot say anything about the documentation you are reading, but it is
    fairly simple.

    Control.BeginInvoke() executes the delegate from the UI thread.

    BeginInvoke calls on delegates execute the delegate from a thread in the
    thread pool. This is a standard asynchronous delegate call.

    Regards,

    - Bruce.


    "Grandma Wilkerson" <> wrote in message
    news:ul%...
    > My question concerns the documentation for Control.BeginInvoke(). At one
    > point is says:
    >
    > "Executes the specified delegate asynchronously with the specified
    > arguments, on the thread that the control's underlying handle was created
    > on."
    >
    > later in that same documentation page it says...
    >
    > "Note The BeginInvoke method calls the specified delegate back on a
    > different thread pool thread. You should not block a thread pool thread

    for
    > any length of time."
    >
    > My impression was that when BeginInvoke is called on a control, the params
    > are placed on the message queue of the UI thread [which created the

    control]
    > and eventually the delegate representing the control's method is called

    *on
    > the control's original UI thread*. Why does the documentation mention the
    > thread pool? Why would a thread pool thread even be involved in this chain
    > of events? I'm one confused granny.
    >
    > Granny
    >
    >
     
    Bruce Brown, Jun 26, 2003
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marina
    Replies:
    5
    Views:
    289
    Mike V
    Apr 1, 2004
  2. Sandor Heese
    Replies:
    2
    Views:
    577
    Sandor Heese
    Jun 23, 2004
  3. Guest
    Replies:
    0
    Views:
    271
    Guest
    Dec 29, 2004
  4. Benoit Martin

    how to terminate a thread started with BeginInvoke?

    Benoit Martin, Jan 12, 2006, in forum: Microsoft Dot NET
    Replies:
    0
    Views:
    553
    Benoit Martin
    Jan 12, 2006
  5. Curious
    Replies:
    1
    Views:
    179
    Jon Skeet [C# MVP]
    Jun 13, 2008
Loading...

Share This Page