You can solve this in different ways.
The best is to let the subvi halt itself. In this way you keep control to the place where it should be. Normally you can do this by looking at some boolean on the frontpanel and stop your while according to that boolean.
If you want boolean buttons on your main vi you can send that information to a global variable and react in your subvi on the state of this global variable. No you are in the non dataflow region of labview and race conditions should taken care of.
There are better methods with queues and other messaging tools but only use them if the former approach is to easy.
greetings from the Netherlands