Skip to content

Commit 20177c2

Browse files
committed
Avoid non-stable feature
1 parent fe45baf commit 20177c2

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

fortanix-vme/tests/iron/src/main.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
#![feature(once_cell)]
21
use iron::prelude::*;
32
use iron::{BeforeMiddleware, AfterMiddleware, typemap};
4-
use std::lazy::SyncOnceCell;
5-
use std::sync::Mutex;
3+
use std::sync::atomic::{AtomicU32, Ordering};
64
use time;
75

8-
static NUM_SUCCEEDING_CONNECTIONS: SyncOnceCell<Mutex<u32>> = SyncOnceCell::new();
6+
static NUM_SUCCEEDING_CONNECTIONS: AtomicU32 = AtomicU32::new(0);
97

108
fn signal_success() {
11-
let mut count = NUM_SUCCEEDING_CONNECTIONS.get_or_init(|| Mutex::new(0)).lock().unwrap();
9+
let mut count = NUM_SUCCEEDING_CONNECTIONS.fetch_add(1, Ordering::Relaxed);
1210
println!("count = {}", count);
13-
*count = *count + 1;
14-
if *count == 3 {
11+
count = count + 1;
12+
if count == 3 {
1513
std::process::exit(0);
1614
}
1715
}

0 commit comments

Comments
 (0)