Update on GameDownload

This commit is contained in:
quexeky
2024-10-18 22:35:03 +11:00
parent f8b96d06e7
commit deae3875f7
6 changed files with 80 additions and 7 deletions
+3 -3
View File
@@ -5,17 +5,17 @@ use rayon::ThreadPoolBuilder;
pub struct ProgressChecker<T>
where T: 'static + Send + Sync
{
counter: AtomicUsize,
counter: Arc<AtomicUsize>,
f: Arc<Box<dyn Fn(T) + Send + Sync + 'static>>,
}
impl<T> ProgressChecker<T>
where T: Send + Sync
{
pub fn new(f: Box<dyn Fn(T) + Send + Sync + 'static>) -> Self {
pub fn new(f: Box<dyn Fn(T) + Send + Sync + 'static>, counter_reference: Arc<AtomicUsize>) -> Self {
Self {
f: f.into(),
counter: AtomicUsize::new(0)
counter: counter_reference
}
}
pub async fn run_contexts_sequentially_async(&self, contexts: Vec<T>) {