I have such particular code:

```
for (int i = 0; i < SingleR_mustBeWorkedUp._number_of_Requestes; i++)
{   
    Random myRnd = new Random(SingleR_mustBeWorkedUp._num_path);
    while (true)
    {    
        int k = myRnd.Next(start, end);
        if (CanRequestBePutted(timeLineR, k, SingleR_mustBeWorkedUp._time_service, start + end) == true) 
        {
            SingleR_mustBeWorkedUp.placement[i] = k;
            break;
        }
    }
}

```

I use an infinite loop here which will end only if `CanRequestBePutted` returns `true`. So how to know that the app isn't responding? 

There is a solution by controlling time of working each loop, but it doesn't seem to be really good. And I can't forecast that is going to happen in every cases. 

Any solutions?