私は C++ でコードを書いており、パラメーターを徹底的に検索しています。問題は、ある種のパラメーターについて、関数が無限ループに入る可能性があり、それを制御できないことです (私の関数ではなく、ブラック ボックスとして使用します)。私の質問は、「時間制限」で関数を実行できるかどうかです。たとえば、10 秒後に関数を中止して次の反復に移動できますか?
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 */
}