stop() and stop_facet(facet_id) now return unit
This commit is contained in:
parent
7b6a2dab76
commit
0d7ac7441f
|
@ -41,7 +41,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
t.dataflow(enclose!((current_value) move |t| {
|
||||
if *t.get(¤t_value) == 1000000 {
|
||||
t.stop()?;
|
||||
t.stop();
|
||||
}
|
||||
Ok(())
|
||||
}))?;
|
||||
|
@ -62,7 +62,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
*count = *count - 1;
|
||||
if *count == 0 {
|
||||
tracing::info!("box state retracted");
|
||||
t.stop()?;
|
||||
t.stop();
|
||||
}
|
||||
Ok(())
|
||||
})))
|
||||
|
|
|
@ -481,7 +481,7 @@ fn run(
|
|||
}
|
||||
}
|
||||
for facet_id in to_stop.into_iter() {
|
||||
t.stop_facet(facet_id)?;
|
||||
t.stop_facet(facet_id);
|
||||
}
|
||||
Ok(())
|
||||
}).unwrap()
|
||||
|
@ -507,7 +507,7 @@ fn run(
|
|||
|
||||
let _ = facet.activate(Account::new(syndicate::name!("termination")), |t| {
|
||||
tracing::trace!("linked thread terminating associated facet");
|
||||
t.stop()
|
||||
Ok(t.stop())
|
||||
});
|
||||
|
||||
tracing::trace!("linked thread done");
|
||||
|
|
|
@ -341,7 +341,7 @@ fn run(
|
|||
let completed = *t.get(&completed_processes);
|
||||
tracing::debug!(total_configs = ?total, completed_processes = ?completed);
|
||||
if total > 0 && total == completed {
|
||||
t.stop()?;
|
||||
t.stop();
|
||||
}
|
||||
Ok(())
|
||||
}))?;
|
||||
|
|
|
@ -33,7 +33,7 @@ struct ShutdownEntity;
|
|||
|
||||
impl Entity<AnyValue> for ShutdownEntity {
|
||||
fn message(&mut self, t: &mut Activation, _m: AnyValue) -> ActorResult {
|
||||
t.stop()
|
||||
Ok(t.stop())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ pub fn bench_pub(c: &mut Criterion) {
|
|||
let ds = Cap::new(&t.create(Dataspace::new()));
|
||||
|
||||
let shutdown = entity(())
|
||||
.on_asserted(|_, _, _| Ok(Some(Box::new(|_, t| t.stop()))))
|
||||
.on_asserted(|_, _, _| Ok(Some(Box::new(|_, t| Ok(t.stop())))))
|
||||
.create_cap(t);
|
||||
|
||||
ds.assert(t, language(), &Observe {
|
||||
|
|
|
@ -68,7 +68,7 @@ pub fn bench_ring(c: &mut Criterion) {
|
|||
tracing::info!(iters = self.iters,
|
||||
actors_created = ACTORS_CREATED.load(Ordering::SeqCst),
|
||||
messages_sent = MESSAGES_SENT.load(Ordering::SeqCst));
|
||||
t.stop()?;
|
||||
t.stop();
|
||||
self.tx.send(self.start.elapsed() / ACTOR_COUNT).unwrap()
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
@ -926,7 +926,7 @@ impl<'activation> Activation<'activation> {
|
|||
f.linked_tasks.remove(&task_id);
|
||||
}
|
||||
if let LinkedTaskTermination::Normal = result {
|
||||
t.stop()?;
|
||||
t.stop();
|
||||
}
|
||||
Ok(())
|
||||
});
|
||||
|
@ -1080,15 +1080,17 @@ impl<'activation> Activation<'activation> {
|
|||
/// Arranges for the [`Facet`] named by `facet_id` to be stopped cleanly when `self`
|
||||
/// commits.
|
||||
///
|
||||
/// Equivalent to `self.stop_facet_and_continue(facet_id, None)`.
|
||||
pub fn stop_facet(&mut self, facet_id: FacetId) -> ActorResult {
|
||||
/// Equivalent to `self.stop_facet_and_continue(facet_id, None)`, except that the lack of a
|
||||
/// continuation means that there's no need for this method to return `ActorResult`.
|
||||
pub fn stop_facet(&mut self, facet_id: FacetId) {
|
||||
self.stop_facet_and_continue::<Action>(facet_id, None)
|
||||
.expect("Non-failing stop_facet_and_continue")
|
||||
}
|
||||
|
||||
/// Arranges for the active facet to be stopped cleanly when `self` commits.
|
||||
///
|
||||
/// Equivalent to `self.stop_facet(self.facet.facet_id)`.
|
||||
pub fn stop(&mut self) -> ActorResult {
|
||||
pub fn stop(&mut self) {
|
||||
self.stop_facet(self.facet.facet_id)
|
||||
}
|
||||
|
||||
|
@ -1098,7 +1100,7 @@ impl<'activation> Activation<'activation> {
|
|||
tracing::trace!("Checking inertness of facet {} from facet {}", facet_id, t.facet.facet_id);
|
||||
if t.state.facet_exists_and_is_inert(facet_id) {
|
||||
tracing::trace!(" - facet {} is inert, stopping it", facet_id);
|
||||
t.stop_facet(facet_id)?;
|
||||
t.stop_facet(facet_id);
|
||||
} else {
|
||||
tracing::trace!(" - facet {} is not inert", facet_id);
|
||||
}
|
||||
|
@ -1986,7 +1988,7 @@ where
|
|||
|
||||
impl<M> Entity<M> for StopOnRetract {
|
||||
fn retract(&mut self, t: &mut Activation, _h: Handle) -> ActorResult {
|
||||
t.stop()
|
||||
Ok(t.stop())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ where
|
|||
let _ = t.prevent_inert_check();
|
||||
assertion_handler(state, t, a)
|
||||
})?;
|
||||
Ok(Some(Box::new(move |_state, t| t.stop_facet(facet_id))))
|
||||
Ok(Some(Box::new(move |_state, t| Ok(t.stop_facet(facet_id)))))
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue