Skip to main content
GameDev.net gamedev.net
🔒 Locked

Multi Thread Programming ?

Started by mojtaba_e Jul 11, 2006 at 1:08 PM 8 replies 1.7k views
Original Post
mojtaba_e
mojtaba_e
Hi there, I wanna some information about Multi thread programming in Visual C++ 6. I want Write a program that have must four threads. This program must Sort an array with four methods(Quick Sort,Merge Sort ,...) Each treads must shown own behavior when program is running. Can you help me about this program ? Thanks,
--Mojtaba--
Alpha_ProgDes
Alpha_ProgDes
Huh? What was that? You want me to do your homework?

Try to [google] Visual C++ Express Edition, Wikipedia, and threads.
Beginner in Game Development?  Read here. And read here.  
jkleinecke
jkleinecke
For starters you should check the Win32 Thread API. If you have seperate data that each thread is operating on you shouldn't run into any issues with 4 threads. If they all have to work on the same data you will run into problems.
-----------------------------------Indium Studios, Inc.
cmptrgear
cmptrgear
CreateThread

At the bottom of that page there is a link to example code showing how to create
threads.
"Pfft, Facts! Facts can be used to prove anything!" -- Homer J. Simpson
mojtaba_e
mojtaba_e
Thanks friends,
I'm sorry.
I don't wish you to solve my Homework!
I wanna only some information about this.
--Mojtaba--
jflanglois
jflanglois
If you want threading to work on multiple operating systems/platforms, you might want to take a look at Boost.Threads.
jkleinecke
jkleinecke
He did say he was using Visual Studio 6, so I would assume that he only needed threads on windows.
-----------------------------------Indium Studios, Inc.
jflanglois
jflanglois
Quote:
Original post by jkleinecke
He did say he was using Visual Studio 6, so I would assume that he only needed threads on windows.

Certainly, but the requirements for his program are not Windows-specific. Besides, Boost.Threads encourages proper use of threads.
Red Ant
Red Ant
Quote:
Original post by jflanglois
If you want threading to work on multiple operating systems/platforms, you might want to take a look at Boost.Threads.


Even so he'd probably be far better off using boost threads over the rather ugly WIN API. It never hurts to write your code in a platform independent way plus boost's threading implementation shields you from a lot of the ugly very low-level fiddling you'd have to do if you were to use the raw WIN API.

Photonman
Photonman
I ran through a lot of problems with trying to learn and implement my first multithreaded programs. In the end, after struggling to get Boost to work, Boost.Thread is what I wound up using. I think that Boost's thread library offers a much clearner, more abstract way to do threading, allowing you to concentrate on the problem at hand instead of figuring out how to make your specific classes and such work with some other lower-level library. There is also a .msi installer for all of Boost (which would have made the job installing Boost a lot easier for me :P) Just go to http://www.boost-consulting.com/ and follow the download link to get the installer.
______Stranger things have happened...The Following Sentence is True. The Above Sentence is False.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.