Last active
October 13, 2015 07:54
-
-
Save sumproxy/0dc392cba936a31c8649 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate itertools; | |
use itertools::Itertools; | |
use std::thread; | |
use std::sync::{Mutex, Arc}; | |
fn is_palindrome(num: u64) -> bool { | |
let s = num.to_string(); | |
s.chars().zip(s.chars().rev()).all(|(i1, i2)| i1 == i2 ) | |
} | |
fn main() { | |
let mut iter = Arc::new(Mutex::new((100..1000).combinations())); | |
for _ in 0..8 { | |
let iter = iter.clone(); | |
thread::spawn(move || { | |
let mut block = iter.lock().unwrap().take(10000); | |
while block.len() > 0 { | |
for tup in block { | |
//TODO | |
} | |
let mut block = iter.lock().unwrap().take(10000); | |
} | |
}); | |
} | |
} |
Author
sumproxy
commented
Oct 13, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment