Skip to content

Commit

Permalink
Fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
Gianmarco Garrisi committed Sep 23, 2024
1 parent bd9e5cb commit 7be19c6
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions examples/finite_resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,18 @@ impl Resource<State> for FiniteQueue {
}

fn client_process(res: ResourceId) -> Box<Process<State>> {
Box::new(move |response: SimContext<State>| {
yield State::new(Effect::Request(res));
if !response.state().queue_full {
yield State::new(Effect::TimeOut(5.0));
yield State::new(Effect::Release(res));
} else {
yield State::new(Effect::Trace);
}
})
Box::new(
#[coroutine]
move |response: SimContext<State>| {
yield State::new(Effect::Request(res));
if !response.state().queue_full {
yield State::new(Effect::TimeOut(5.0));
yield State::new(Effect::Release(res));
} else {
yield State::new(Effect::Trace);
}
},
)
}

fn main() {
Expand Down

0 comments on commit 7be19c6

Please sign in to comment.