The easy way is to use a local variable of the stop button for your main loop. Right click and point to Create>>Local variable. Move the local into the other loop and wire it to the stop terminal of the loop.
In order to get away from using locals (or globals for that matter) you could use a semaphore. You need to create one first, pass it to both while loop and allow the first while loop the ability to destroy the semaphore. When it is destroyed, the 'timed out' terminal will be true. This case in your other loop will stop the loop. The false case of the 'timed out' terminal will be your code.
Jared