while(1)
{
  if (flag) //should be sampled many times
    break;
}