Release the mutex early, no need for spawning threads
This commit is contained in:
parent
709948b6c0
commit
201fce5088
|
@ -47,31 +47,30 @@ fn main() {
|
||||||
|
|
||||||
for _ in rx {
|
for _ in rx {
|
||||||
|
|
||||||
let mut tasks = tasks.lock().unwrap();
|
let uri = {
|
||||||
|
let mut tasks = tasks.lock().unwrap();
|
||||||
|
tasks.pop()
|
||||||
|
};
|
||||||
|
|
||||||
while let Some(uri) = tasks.pop() {
|
if let Some(uri) = uri {
|
||||||
|
|
||||||
thread::spawn(move || {
|
let builder = GeneralBuilder::new();
|
||||||
|
let uri = percent_decode(uri.path().as_bytes()).decode_utf8().unwrap();
|
||||||
|
let (path, args) = builder_arguments_from_string(&*uri);
|
||||||
|
|
||||||
let builder = GeneralBuilder::new();
|
let path_string = path.to_str().unwrap();
|
||||||
let uri = percent_decode(uri.path().as_bytes()).decode_utf8().unwrap();
|
let start_string = format!("---- STARTING BUILD ---- from {} {}", path_string, args.join(" "));
|
||||||
let (path, args) = builder_arguments_from_string(&*uri);
|
println!("{}", start_string.bold().green());
|
||||||
|
|
||||||
let path_string = path.to_str().unwrap();
|
match builder.build(&path, &args) {
|
||||||
let start_string = format!("---- STARTING BUILD ---- from {} {}", path_string, args.join(" "));
|
Err(_) => {
|
||||||
println!("{}", start_string.bold().green());
|
println!("{}", "--------- FAIL ---------".bold().red());
|
||||||
|
},
|
||||||
match builder.build(&path, &args) {
|
Ok(_) => {
|
||||||
Err(_) => {
|
println!("{}", "----- SUCCESSFUL -----".bold().green());
|
||||||
println!("{}", "--------- FAIL ---------".bold().red());
|
},
|
||||||
},
|
};
|
||||||
Ok(_) => {
|
println!();
|
||||||
println!("{}", "----- SUCCESSFUL -----".bold().green());
|
|
||||||
},
|
|
||||||
};
|
|
||||||
println!();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue