1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
mod config;
mod pipeline;
mod sink;

use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;

pub use config::{Config, ConfigError};
pub use pipeline::{Pipeline, PipelineError};

#[derive(Default, Clone)]
pub(crate) struct AbortSignal {
    aborted: Arc<AtomicBool>,
}

impl AbortSignal {
    pub(crate) fn new() -> Self {
        Self::default()
    }

    pub(crate) fn abort(&self) {
        self.aborted.store(true, Ordering::SeqCst);
    }

    pub(crate) fn is_aborted(&self) -> bool {
        self.aborted.load(Ordering::SeqCst)
    }
}