()
| 1309 | |
| 1310 | let v = counter.load(Ordering::SeqCst); |
| 1311 | assert_eq!(v, 11); |
| 1312 | |
| 1313 | THREAD_POOL.depopulate(); |
| 1314 | } |
| 1315 | |
| 1316 | /// Test that it is possible to borrow local data within a scope, modify it, |
| 1317 | /// and then read it later. This is mostly here to ensure stuff like this |
| 1318 | /// compiles. |
| 1319 | #[test] |
| 1320 | fn scope_borrow() { |
| 1321 | static THREAD_POOL: ThreadPool = ThreadPool::new(); |
| 1322 | THREAD_POOL.resize_to_available(); |
| 1323 | |
| 1324 | let mut string = "a"; |
| 1325 | THREAD_POOL.scope(|scope| { |
| 1326 | scope.spawn(|_: &Worker| { |
| 1327 | string = "b"; |
| 1328 | }); |
| 1329 | }); |
| 1330 | assert_eq!(string, "b"); |
nothing calls this directly
no test coverage detected