Currently it waits until it gets a signal before moving on. It reads pulses until it sees one that's long enough, in a loop that waits forever. To make it non-blocking, consider relying on the circular buffer of pulseio.