| 279 | |
| 280 | #[test] |
| 281 | fn concurrent_32x50_unique() { |
| 282 | let reg = Arc::new(DatabaseRegistry::new()); |
| 283 | let mut handles = Vec::with_capacity(32); |
| 284 | for _ in 0..32 { |
| 285 | let r = reg.clone(); |
| 286 | handles.push(std::thread::spawn(move || { |
| 287 | (0..50).map(|_| r.alloc_one().as_u64()).collect::<Vec<_>>() |
| 288 | })); |
| 289 | } |
| 290 | let mut all: Vec<u64> = handles |
| 291 | .into_iter() |
| 292 | .flat_map(|h| h.join().unwrap()) |
| 293 | .collect(); |
| 294 | all.sort(); |
| 295 | all.dedup(); |
| 296 | assert_eq!(all.len(), 1600); |
| 297 | } |
| 298 | |
| 299 | #[test] |
| 300 | fn flush_ops_threshold() { |