PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms Control.BeginInvoke(), which thread?

Reply

Control.BeginInvoke(), which thread?

 
Thread Tools Rate Thread
Old 25-06-2003, 03:47 PM   #1
Grandma Wilkerson
Guest
 
Posts: n/a
Default Control.BeginInvoke(), which thread?


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


  Reply With Quote
Old 26-06-2003, 08:38 AM   #2
Bruce Brown
Guest
 
Posts: n/a
Default Re: Control.BeginInvoke(), which thread?

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" <turd@bottleneck.scalability.crash.dum> wrote in message
news:ul%23lLEzODHA.560@TK2MSFTNGP10.phx.gbl...
> 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
>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off