How to break a loop

I've looked around for this, but I can't get a clear answer. If I have a function that is running and looping (Not the void loop) and I want to stop it, is there a way to send a command through Bridge to kill the loop? Example: I have a variable set to 0 and when I send the kill command it is set to 1 which is detected by an if statement in the functions loop? Thanks in advance for any ideas or guidance!

do
{
your code.........

x = your variable

} while (x = 0);

Thanks for the reply, I wasn't clear with my question I realize. What I'm trying to figure out is, can the command come in through bridge while the loop is running, or will the loop need to complete before the variable can be updated. Thanks!

There are som interesting words in this language:
lookup thee two: BREAK and CONTINUE

do
{
your code.........

Bridge.get("command",data,1);
delay(10);

} while (data == 0);

Ok interesting, so if I'm understanding this correctly, in order to receive a bridge command during a function that's looping, we need to check the bridge for the command at each loop? Otherwise the bridge command will be buffered until the loop is complete? Thanks for the help!

alanblinkers:
Ok interesting, so if I'm understanding this correctly, in order to receive a bridge command during a function that's looping, we need to check the bridge for the command at each loop? Otherwise the bridge command will be buffered until the loop is complete? Thanks for the help!

Correct. How else would you consider it would be possible for the Linino side to talk to the Leonardo side, when the only thing that connects those two parts is the serial connection over which the bridge "runs"?
It isn't really any different than for example reacting to a button pushed that connects to the I/O pins of the Leonardo side. You would likely to poll for the status on those pin(s) as well.

Ralf

PS: Yes, you can have interrupts to react on things like a button push, but that isn't really an option with the bridge between Linino/Leonardo AFAIK