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.
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.
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.
You didn't answer my first question >.<
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
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.