473,410 Members | 1,937 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,410 software developers and data experts.

Invoking to a busy UI thread

Here's my question:

I have Windows Forms app. Suppose the user clicks on the "Processing"
button on the UI. The UI thread then starts processing. During this
processing another thread calls invoke to update a control on the UI.

When the UI thread reaches the end of its time slice--even though it
has not completed it's processing--can the other thread invoke onto
the UI thread and do the update it wants?

My intuition (and some brief testing) tells me that the invoke will
not happen until the UI thread is completely finished with its
processing, but I haven't found it stated anywhere. Does anyone know
the answer to this?

Thanks.

Jul 31 '07 #1
1 2294
<ge******@earthlink.netwrote:
Here's my question:

I have Windows Forms app. Suppose the user clicks on the "Processing"
button on the UI. The UI thread then starts processing. During this
processing another thread calls invoke to update a control on the UI.

When the UI thread reaches the end of its time slice--even though it
has not completed it's processing--can the other thread invoke onto
the UI thread and do the update it wants?
No.
My intuition (and some brief testing) tells me that the invoke will
not happen until the UI thread is completely finished with its
processing, but I haven't found it stated anywhere. Does anyone know
the answer to this?
Yes, that's the case - unless you call the horrible DoEvents method
(which introduces the spectre of re-entrancy etc).

You should avoid the UI thread doing a lot of processing though - it's
not just your other thread which might want to do things with the UI.
The user might move another window in front of it and then away again,
or resize it, or move it, or any number of other things which require
the UI thread's attention.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jul 31 '07 #2

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

Similar topics

29
by: Paul L. Du Bois | last post by:
Has anyone written a Queue.Queue replacement that avoids busy-waiting? It doesn't matter if it uses os-specific APIs (eg WaitForMultipleObjects). I did some googling around and haven't found...
5
by: eskwayrd | last post by:
Hi group, I'm trying to add a busy indicator to the sorttable.js code available at: http://www.kryogenix.org/code/browser/sorttable/ (Actually, my version is modified for my needs, such as...
1
by: Michael S. Scherotter | last post by:
I have a proxy class derived from System.Web.Services.Protocols.SoapHTTPClient that calls a web service. Sometimes, because the call takes a longer time, I get the OLE server busy dialog. Is...
0
by: aartinawani | last post by:
Hi I have an asp.net application running under Windows 2003 Server, IIS 6, for 2 years. Today, suddenly, the site went down at 3:38 pm and the application raised an error entitled "Server too...
25
by: MuZZy | last post by:
Hi, I'm currently rewriting some functionality which was using multithredaing for retrieving datasets from database and updating a grid control. I found that the grids (Infragistics UltraGrid,...
3
by: Matthew Lock | last post by:
Hello, I am automating Internet Explorer in order to do some simple automated testing of a web application. How do I invoke Javascript functions in the web page I load? I can successfully start...
6
by: DaTurk | last post by:
I know in a WinForm you can check if an Invoke is inquired and invoke a method on the main thread. But can you do this in a class? Can I call Invoke(someMethod) in my asynch event handler? And...
3
by: Thijs | last post by:
Hello everybody, I´ve got a problem that´s slightly complicated (at least to me it seems) so I will try to state it as clearly as possible. At a certain point in time, I start a second thread...
2
by: =?Utf-8?B?SmltIE93ZW4=?= | last post by:
Hi John, Hopefully this post will find its way back to you - or perhaps be answered by someone else. As I mentioned in my last post on the earlier portion of this thread, changing the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.