taskflowrs 0.1.1

A Rust implementation of TaskFlow — task-parallel programming with heterogeneous GPU support
Documentation
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::thread::JoinHandle;

/// Future returned from executor.run() to track task completion
pub struct TaskflowFuture {
    workers: Vec<JoinHandle<()>>,
    shutdown: Arc<AtomicBool>,
}

impl TaskflowFuture {
    pub(crate) fn new(workers: Vec<JoinHandle<()>>, shutdown: Arc<AtomicBool>) -> Self {
        Self { workers, shutdown }
    }

    /// Wait for the taskflow to complete
    pub fn wait(self) {
        for worker in self.workers {
            let _ = worker.join();
        }
    }

    /// Check if the taskflow is still running
    pub fn is_running(&self) -> bool {
        !self.shutdown.load(Ordering::SeqCst)
    }
}