For some reason I can't find a site or through VC++ help, an easy explination of how to impliment multi threading in C++.

I understand the concepts of it, mutexes, multithread debugging and concurrency, but every time I find about how to do a multithreaded program, it all looks like greek.

I don't need an indepth understanding of it, I just need to do a basic 4 threaded program. 3 of the threads need a parameter passed to it. Its going to be a class. The last thread is to watch keyboard input while the program is running.

Also, pointers. Why Pointers? Read about them, used them, can't really find a why and when you SHOULD use them.

Originally posted by Brandon@Feb 27 2005, 09:59 AMFor some reason I can't find a site or through VC++ help, an easy explination of how to impliment multi threading in C++.

I understand the concepts of it, mutexes, multithread debugging and concurrency, but every time I find about how to do a multithreaded program, it all looks like greek.

I don't need an indepth understanding of it, I just need to do a basic 4 threaded program. 3 of the threads need a parameter passed to it. Its going to be a class. The last thread is to watch keyboard input while the program is running.

Also, pointers. Why Pointers? Read about them, used them, can't really find a why and when you SHOULD use them.

Thank you for any help.

[post=5653]Quoted post[/post]​

Click to expand...

If you want to do some EASY multi-threading in C++, go pick up MUD Game Programming by Ron Penton. He has generated a simple multi threading class and mutex arrangement that is cake which. He used it to make saves n what not without laggin down the system, but you can apply them just about anywhere.

I used 3 threads to do a var update routine and screen display while awaiting a key to be pressed to pause the program.

SImple as

ThreadLib::ThreadID A,B,C etc;
ThreadLib::Mutex m1,m2, etc

A=ThreadLib::Create(FuncName1,(void*) YourONEvarToPass);
//Thread execution would start right then in what ever function your writing.and then continue on in the current function while the thread begins to run in parallel.

the void* for those that don't know is an untyped varible. You can send ANYTHING into it, but only 1 varible may pass. You just got to type cast it once within the thread. I.e. int YourVar, or YourClass YourVar, etc.