|
|
|
@ -7,7 +7,7 @@ use std::{
@@ -7,7 +7,7 @@ use std::{
|
|
|
|
|
atomic::{AtomicI32, Ordering}, |
|
|
|
|
Arc, |
|
|
|
|
}, |
|
|
|
|
time::Duration, |
|
|
|
|
time::Duration, mem::swap, |
|
|
|
|
}; |
|
|
|
|
use thiserror::Error; |
|
|
|
|
use tokio::{ |
|
|
|
@ -38,6 +38,7 @@ enum RunnerMsg {
@@ -38,6 +38,7 @@ enum RunnerMsg {
|
|
|
|
|
Quit, |
|
|
|
|
QueueRun(RunHandle, SectionRef, Duration), |
|
|
|
|
CancelRun(RunHandle), |
|
|
|
|
CancelAll, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#[derive(Debug)] |
|
|
|
@ -170,6 +171,14 @@ async fn runner_task(
@@ -170,6 +171,14 @@ async fn runner_task(
|
|
|
|
|
trace!(handle = handle.0, "cancelling run by handle"); |
|
|
|
|
run.cancel(&*interface); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
CancelAll => { |
|
|
|
|
let mut old_runs = LinkedList::new(); |
|
|
|
|
swap(&mut old_runs, &mut run_queue); |
|
|
|
|
trace!(count = old_runs.len(), "cancelling all runs"); |
|
|
|
|
for mut run in old_runs { |
|
|
|
|
run.cancel(&*interface); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
@ -235,7 +244,8 @@ impl SectionRunner {
@@ -235,7 +244,8 @@ impl SectionRunner {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub async fn cancel_all(&mut self) -> Result<()> { |
|
|
|
|
todo!() |
|
|
|
|
self.msg_send.send(RunnerMsg::CancelAll).await?; |
|
|
|
|
Ok(()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub async fn pause(&mut self) -> Result<()> { |
|
|
|
|