I am writing a program (implementing a genetic algorithm) that runs another program using a "system" method to calculate suitability. The problem is that another program sometimes freezes indefinitely. How can I execute a program with some time limit from C ++.
Both POSIX and C ++ solutions are welcome. And more or less, this will be done after the application, so the solution does not have to be very elegant.
I am running a Linux CentOS distribution and testing Cygwin. For the compiler, I am using gcc 4.1.2 with the boost library.
Any help would be appreciated
source
share