Hello
I have a problem with rust multi-threading
and I hope somebody could help me
with that
I have a single function that I want to call it simultaneously with specefic number of threads(ex:30)
but I want to keep threads up to given number until the whole process finishes
when a thread finishes its job ,
anotherone spawn
but my program now is waiting for all those threads to be finished
and then spawn another 30 threads
here is my code
I would be really thankful if somone could help me
let (tx,rx) = mpsc::sync_channel::<JoinHandle<()>>(thread);
loop{
if ips.len()==0{
break;
}
match rx.recv(){
Ok(handle)=> {
handle.join().unwrap();
bar.inc(1);
each_thread_job(&ips.pop().clone().unwrap(), config_file.clone(),curl_installed.clone(),tx.clone());
},
Err(e)=>eprint!("{:?}",e)
}
}