File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
fortanix-vme/tests/iron/src Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 1- #![ feature( once_cell) ]
21use iron:: prelude:: * ;
32use iron:: { BeforeMiddleware , AfterMiddleware , typemap} ;
4- use std:: lazy:: SyncOnceCell ;
5- use std:: sync:: Mutex ;
3+ use std:: sync:: atomic:: { AtomicU32 , Ordering } ;
64use time;
75
8- static NUM_SUCCEEDING_CONNECTIONS : SyncOnceCell < Mutex < u32 > > = SyncOnceCell :: new ( ) ;
6+ static NUM_SUCCEEDING_CONNECTIONS : AtomicU32 = AtomicU32 :: new ( 0 ) ;
97
108fn 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}
You can’t perform that action at this time.
0 commit comments