Archived

This topic is now archived and is closed to further replies.

Multi-threading

This topic is 5979 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Should I use multi-threading? To me, it''s kind of confusing. How do I tell windows what order to execute my threads in? I want full control over order, and that''s what scares me about multi-threading. I just don''t know if it''s worth it.

Share this post


Link to post
Share on other sites
With multi-threading you DON''T tell Windows what order to do things in for the most part. That is why it is usually best to have threads that are dedicated to performing mostly unrelated tasks. (Like one is planning the computer player''s moves for the next turn while another thread is drawing the display for the player)

If threads need to share data in some way, you need to look into using critical sections or some mutual exclusion technique. Look up CreateCriticalSection on MSDN for more info to get started. Multi-threading can be very useful in some circumstances, however you must be careful because some things (namely DirectGraphics) do not operate well on more than one thread of execution. This means that one single thread needs to do all your drawing.

Share this post


Link to post
Share on other sites