Jump to content
  • Advertisement
Sign in to follow this  
Asuralm

Multithread in C++

This topic is 3690 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

Hi all: I have a function
void FuncA(obj o, arg1 a1, arg2 a2);
Because I have to run the FuncA for many times for different objects, I am thinking it's probably better to run multithread so that each thread contains each object. I have just read a small tutorial in http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html However, I am still not sure how to start a thread if the arguments of FuncA is multiple. Also, the pthread_t looks quite out-of-date and it's in C although it works in C++. Could anyone give me any idea how to do this please? Thanks

Share this post


Link to post
Share on other sites
Advertisement
I've recently written a library which does exactly that. It requires boost to run, but other than that it's just a header you include.

Flow

Just make sure that threads don't alter the same objects without locks, and all will be fine.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!