Advised way to sync to threads

  • Thread starter Thread starter chris.dannemiller
  • Start date Start date
C

chris.dannemiller

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.
 
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/threads/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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top