Release the mutex early, no need for spawning threads
This commit is contained in:
parent
709948b6c0
commit
201fce5088
|
@ -47,11 +47,12 @@ fn main() {
|
||||||
|
|
||||||
for _ in rx {
|
for _ in rx {
|
||||||
|
|
||||||
|
let uri = {
|
||||||
let mut tasks = tasks.lock().unwrap();
|
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 builder = GeneralBuilder::new();
|
||||||
let uri = percent_decode(uri.path().as_bytes()).decode_utf8().unwrap();
|
let uri = percent_decode(uri.path().as_bytes()).decode_utf8().unwrap();
|
||||||
|
@ -71,8 +72,6 @@ fn main() {
|
||||||
};
|
};
|
||||||
println!();
|
println!();
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue