Resubscribe before waiting for Task in Emulator
This commit is contained in:
parent
720ffa3e0b
commit
2d83da799a
1 changed files with 4 additions and 4 deletions
|
|
@ -101,8 +101,8 @@ impl<P: Program + 'static> Emulator<P> {
|
||||||
pending_tasks: 0,
|
pending_tasks: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
emulator.wait_for(task);
|
|
||||||
emulator.resubscribe(program);
|
emulator.resubscribe(program);
|
||||||
|
emulator.wait_for(task);
|
||||||
|
|
||||||
emulator
|
emulator
|
||||||
}
|
}
|
||||||
|
|
@ -110,6 +110,8 @@ impl<P: Program + 'static> Emulator<P> {
|
||||||
pub fn update(&mut self, program: &P, message: P::Message) {
|
pub fn update(&mut self, program: &P, message: P::Message) {
|
||||||
let task = program.update(&mut self.state, message);
|
let task = program.update(&mut self.state, message);
|
||||||
|
|
||||||
|
self.resubscribe(program);
|
||||||
|
|
||||||
match self.mode {
|
match self.mode {
|
||||||
Mode::Zen if self.pending_tasks > 0 => self.wait_for(task),
|
Mode::Zen if self.pending_tasks > 0 => self.wait_for(task),
|
||||||
_ => {
|
_ => {
|
||||||
|
|
@ -120,8 +122,6 @@ impl<P: Program + 'static> Emulator<P> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.resubscribe(program);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn perform(&mut self, program: &P, action: Action<P>) {
|
pub fn perform(&mut self, program: &P, action: Action<P>) {
|
||||||
|
|
@ -290,8 +290,8 @@ impl<P: Program + 'static> Emulator<P> {
|
||||||
program.update(&mut self.state, message)
|
program.update(&mut self.state, message)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
self.wait_for(task);
|
|
||||||
self.resubscribe(program);
|
self.resubscribe(program);
|
||||||
|
self.wait_for(task);
|
||||||
}
|
}
|
||||||
Instruction::Expect(expectation) => match expectation {
|
Instruction::Expect(expectation) => match expectation {
|
||||||
instruction::Expectation::Text(text) => {
|
instruction::Expectation::Text(text) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue