0

How can i run my program for a specific amount of time?
And what is threading?

I'm really new to C++ so i'd like n00b-friendly answers.

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by Freaky_Chris
0

Threading is running multiple processes at once.

or translated, a program doing multiple tasks at the same time.

Because doing multiple things at the same time may affect certain things such as changing data.

If Thread A is changing data and Thread B comes across and also wants to change data, in order to avoid a collision, there is a method/a "lock", that all threads test to see if anyone is changing data, if there is, they wait.

You can google some Thread tutorials online.

0

To run your program for a specific amout of time, you are correct you will need threading.

Once you understand threading, you may want to have a look at the ctime header

http://www.cplusplus.com/reference/clibrary/ctime/

This will provide a method of checking how long the program has been running, you would set this check up in a different thread to everything else.

Chris

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.