473,387 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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
Jul 19 '05 #1
1 6593
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" <tu**@bottleneck.scalability.crash.dum> wrote in message
news:ul***************@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

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Grandma Wilkerson | last post by:
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...
2
by: Ingo Schasiepen | last post by:
Hi there, i'm evaluating if c# is suited to replace a script language. Most of the elements of this language can be replaced with a c#-library, but it also has some realtime-like elements. E.g.,...
9
by: David Sworder | last post by:
Hi, I have a form that displays data (is that vague enough for you?). The data comes in on a thread-pool thread. Since the thread pool thread is not the same as the UI thread, the callback...
6
by: Valerie Hough | last post by:
I'm not entirely sure what the difference is between these two approaches. In order to avoid reentrant code, I was using Control.BeginInvoke in my UI to cause an asynchronous activity to be done...
9
by: john doe | last post by:
I have a question about BeginInvoke method found on the Control class. To quote the docs: "Executes the specified delegate asynchronously with the specified arguments, on the thread that the...
5
by: RWF | last post by:
I have a form, and from the form when a user clicks a button, it instantiates control that will be doing a lot of logic. I am trying to use System.Threading.ThreadPool.QueueUserWorkItem to spawn a...
7
by: Ben Voigt [C++ MVP] | last post by:
As much as the CLR team assures us that it's ok to fire-and-forget Control.BeginInvoke, it seems it isn't. Maybe this is a bug. See for example: the comments in...
3
by: Steve | last post by:
Hi All I am using VB.net 2008 and use timer controls within my applications Question Does the code in a Timer control.tick event run on a different thread to the main Application thread (UI...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.