Reading a variable set in an ISR, or using millis() for time within while loop?

OP, this code doesn’t do what you described in your original post. The function subx() never exits. Whatever you’re trying to do, this is a pretty convoluted way of doing it. Perhaps describe again what you want to accomplish?