day10: part2 fix sem lock early release

master
Avril 4 years ago
parent 19da63e47f
commit 3713a81fdd
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -110,6 +110,7 @@ fn rec_part2(map: Arc<Adaptors>, cache: Arc<Cache>, lock: Semaphore<()>, max: u8
let lock = lock.clone();
if let Ok(_guard) = lock.try_access() {
Deffered::Yielded(thread::spawn(move || {
let _guard = _guard; // move guard into new thread
cache.clone().insert(next, rec_part2(map, cache, lock, max, next))
}))
} else {

Loading…
Cancel
Save