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