Hi there,

Hopefully this a quick question.

Say i have program prog1.cpp and prog2.cpp

and they will both take the same amount of time.

i.e. One is reading a file and outputs a figure and the other is a video application

Is there a way i can get these to run concurrently without having to combine the two?

Kind Regards,
Dave

Recommended Answers

All 3 Replies

You mean you have two *.cpp files that you want to compile together into one executable program? Yes, put one in the program's main thread, create another thread during initial startup in main() then put the other code in the second thread. Exactly how to do that depends on the operating system.

Many Thanks for the reply, i was trying to prevent splashing my code on here, as its implementation is not the most elegant :)

Basically, one file is implementing a mouse moving system, which is controlled from a flat file

The other is an a quick application i made with Open CV. However i cannot seem to combine them within the one file. They will both compile and run as applications (.exe) on their own in windows. Would it be more feasilble to say, to create a third c++ file, which would run the two .exe's concurrently?

I am using Windows XP by the way

I am new to threading you see, so my knowledge isn't the greatest. I am continuing to learn, but i was hoping to give a demonstration of my work thus far. However they may have to be individual showings for the time being

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.