I'm trying to make an actor 'go to sleep' waiting for another actors signal. I want to do something like:
def act(){
loop{ //Should I use loop here too??
if(sleepy){
react{
//SLEEPING
case "Wake Up"=> sleepy=false; //just to breack the react
}
}else{
react{
//React to other messages
}
}
}
}
Now, what happends with other messages when my actor is sleeping? do they get discarted? I don't want to lose them. What is a good way to fix this?