Arduino with two uC. Problem with communication.

I thought that it is the safest way to do that sort of things - one uC controling the motors, and the second one waiting for an error message sounds logical.
I don't know how could I write a software for uC where I'm processing the loop (to move the stepper motor) and in the same time reading the incoming messages to RX pin.

An "emergency" situation occures when a limit switch is pressed by a platform, or simply when the user wants to stop the motors from Java app on his PC.

How can you perform while(Serial.available() > 1) {do sth} while doing this:

for(i=0; i<=y; i++){ // move x motor
digitalWrite(6, HIGH);
delay(timeout);
digitalWrite(6, LOW);
delay(timeout);
}

?