I'm writing code in C++, and do an exhaustive search on the parameters. The problem is that for some kind of parameters, the function might goes into an infinite loop, and I can't control it (not my function, using it as a black box). My question is, can I run the function with a "time limit", so after, say 10 seconds, abort from the function and move for the next iteration?
for(int i=0; i < 100; i++){
aBlackBoxFunction(i);
/* This function may goes into a infinite loop :(
I want that if it won't end after 10 seconds, the function would abort and move to the next iteration. I can't change the function itself */
}