I've found myself coding this type of thing a few times.
for (int i = 0; i < 10; i++)
{
if (Thing.WaitingFor())
{
break;
}
Thread.Sleep(sleep_time);
}
if(!Thing.WaitingFor())
{
throw new ItDidntHappenException();
}
It just looks like bad code, is there a better way of doing this / is it a symptom of bad design?