SHARE
TWEET

Untitled

a guest Jul 19th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. extern crate scoped_threadpool;
  2.  
  3. use scoped_threadpool::Pool;
  4.  
  5. #[test]
  6. fn no_leak() {
  7.     let counters = ::std::sync::Arc::new(());
  8.  
  9.     let mut pool = Pool::new(4);
  10.     pool.scoped(|scoped| {
  11.         let c = ::std::sync::Arc::clone(&counters);
  12.         scoped.execute(move || {
  13.             let _c = c;
  14.             ::std::thread::sleep(::std::time::Duration::from_millis(100));
  15.         });
  16.     });
  17.     drop(pool);
  18.     assert_eq!(::std::sync::Arc::strong_count(&counters), 1);
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top