Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate scoped_threadpool;
- use scoped_threadpool::Pool;
- #[test]
- fn no_leak() {
- let counters = ::std::sync::Arc::new(());
- let mut pool = Pool::new(4);
- pool.scoped(|scoped| {
- let c = ::std::sync::Arc::clone(&counters);
- scoped.execute(move || {
- let _c = c;
- ::std::thread::sleep(::std::time::Duration::from_millis(100));
- });
- });
- drop(pool);
- assert_eq!(::std::sync::Arc::strong_count(&counters), 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement