471,315 Members | 1,508 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Advised way to sync to threads

What is the advised way to sync to threads one is the primary thread
that handles rendering, and a secondary thread that occasionally
updates the data the render thread uses. I have tried a few things like
the Interlocked routines but they don't work like they did in MFC.

Feb 5 '06 #1
1 1074
ch***************@gmail.com <ch***************@gmail.com> wrote:
What is the advised way to sync to threads one is the primary thread
that handles rendering, and a secondary thread that occasionally
updates the data the render thread uses. I have tried a few things like
the Interlocked routines but they don't work like they did in MFC.


If the render thread is a UI thread, you should use
Control.Invoke/BeginInvoke if you're changing the UI (or want to
marshall any other call to the UI thread). See
http://www.pobox.com/~skeet/csharp/t...winforms.shtml

Otherwise, read the rest of the article (that's a page from the middle
of the article) and see if it helps you, then come back and ask again
(with more details) if it doesn't.

--
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
Feb 5 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Daniel | last post: by
1 post views Thread by kartik | last post: by
3 posts views Thread by Angus | last post: by
7 posts views Thread by john | last post: by

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.