Re: Intermittent work in UI thread



Thanks for your help.

I'm sorry for not explaining better. In "need it to be responsive", the "it" was referring to the secondary UI thread :)

I needed to be able to pause or query the secondary thread even when it was "waiting" 1 min between cycles. This would exclude any Sleep() call.

Pedro Ferreira

Joseph M. Newcomer wrote:
I presumed that by "keep the UI responsive" the OP meant that there should be no blocking
calls in the main UI thread itself; that the secondary UI thread would be doing background
work. So the main GUI thread would not be blocked, but the UI thread provides a nice
queueing mechanism, and doesn't require any PeekMessage hacks.

For example, see my serial port example on my MVP Tips site, which uses a worker thread to
handle input but a UI thread to handle output.
joe

On Tue, 16 Oct 2007 07:31:31 GMT, jetan@xxxxxxxxxxxxxxxxxxxx ("Jeffrey Tan[MSFT]") wrote:

Hi Joseph,

Yes, I agree that using the build-in message queue of the GUI thread will make us a bit easy for coding. But, as the OP stated, he wanted to keep the UI responsive, so I assume that he will show visible windows. Then, this depends on whether his background work is length or not. If the background work will cost a lot of time, it definite will block the GUI message dispatching which causes non-responsible for this UI thread. Sure, we may use PeekMessage to lighten this problem.

Anyway, this depends on the OP's specific scenario. Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: Intermittent work in UI thread
    ... Thank you again Joseph, that is exactly what I was trying to do. ... The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. ...
    (microsoft.public.vc.mfc)
  • Re: multithreaded tcp/ip server large page file
    ... Part of the processing being done by each thread is contacting a sql server and if the sql server is having problems processing by this program backs up and I've seen it with over 100 threads open before. ... It handles it fine as the sql request time out this program returns and error response to the TCP/IP client that the thread is handling and the sub/tread ends. ... The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: multithreaded tcp/ip server large page file
    ... Part of the processing being done by each thread is contacting a sql server and if the sql server is having problems processing by this program backs up and I've seen it with over 100 threads open before. ... It handles it fine as the sql request time out this program returns and error response to the TCP/IP client that the thread is handling and the sub/tread ends. ... The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: multithreaded tcp/ip server large page file
    ... Part of the processing being done by each thread is contacting a sql server and if the sql server is having problems processing by this program backs up and I've seen it with over 100 threads open before. ... It handles it fine as the sql request time out this program returns and error response to the TCP/IP client that the thread is handling and the sub/tread ends. ... The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: multithreaded tcp/ip server large page file
    ... Delete the original counters by clicking DELETE key on keyboard; ... The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. ...
    (microsoft.public.dotnet.languages.vb)

Loading