Compare commits

..

1 commit

Author SHA1 Message Date
b03eae4f0e move parse out of loop 2021-12-28 16:02:53 -05:00

View file

@ -39,11 +39,11 @@ fn main() {
*p = res.unwrap(); *p = res.unwrap();
} }
let lock_c = Arc::clone(&lock); let lock_c = Arc::clone(&lock);
let mut lights = lock_c.write().unwrap();
loop { loop {
thread::sleep(time::Duration::from_millis(250)); thread::sleep(time::Duration::from_millis(250));
let pattern_c = Arc::clone(&pattern); let pattern_c = Arc::clone(&pattern);
let v = pattern_c.read().expect("could not read pattern"); let v = pattern_c.read().expect("could not read pattern");
let mut lights = lock_c.write().unwrap();
(*v).iter().for_each(move |x: &Box<dyn Pattern>| { (*v).iter().for_each(move |x: &Box<dyn Pattern>| {
x.execute(&mut lights); x.execute(&mut lights);
}); });