Debian Codegraph @

.cargo/vendor/once_cell/examples/reentrant_init_deadlocks.rs

raw
1 fn main() {
2 let cell = once_cell::sync::OnceCell::<u32>::new();
3 cell.get_or_init(|| {
4 cell.get_or_init(|| 1);
5 2
6 });
7 }
8
9 /// Dummy test to make it seem hang when compiled as `--test`
10 /// See https://github.com/matklad/once_cell/issues/79
11 #[test]
12 fn dummy_test() {
13 std::thread::sleep(std::time::Duration::from_secs(4));
14 }