interrupting a function

Alex sascha.orlov at gmail.com
Sat Nov 17 06:19:25 UTC 2018


I wished I never come across the nightmare of such a question. 
And maybe, there is still a bug in my code, which I'm not aware 
of (which I strongly suppose :/ ).
But nevertheless, and for learning purposes, assume I have 
something like this:

´´´
auto foo(/*input params*/)
{
     //some long calculations, depending on input params.
}

void main()
{
     foo;
}
´´´

It can happen, that the input params are correct, however, the 
calculation lasts too long. Is there a way, to measure the 
execution time of foo (á la benchmark) and then, if some 
execution time limit is exceeded to interrupt the calculation? At 
best, with a flag, whether foo ended normally or because of the 
interruption.


More information about the Digitalmars-d-learn mailing list