AFAICS there are many pitfalls:
1) An interrupt can be being serviced, so the pulse is over before you get to see it.2) If you're looking for a pulse, you should be looking edge triggered rather than level triggered, but even then you may not get to react to the edge immediately because of an interrupt being serviced, so you'd get an anomalous result.
3) You can look level triggered, but you need to turn off all interrupts to ensure you really are loking at it in real time.4) I had a play with an ultrasonic ranger a couple of years or so ago. I couldn't understand why I wasn't getting any return pulses at all. I eventually realised that I was sending another start pulse before the current cycle had finished.
Regardless, you need an escape from any and every potential infinite loop. Whatever you're doing.
If you can use a hardware timer in the chip, that's a much more reliable solution.
David