File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -46,11 +46,18 @@ impl Thread {
4646 type_ : wasi:: EVENTTYPE_CLOCK ,
4747 u : wasi:: raw:: __wasi_subscription_u { clock : clock } ,
4848 } ] ;
49- let mut out: [ wasi:: Event ; 1 ] = [ unsafe { mem:: zeroed ( ) } ] ;
50- let n = unsafe { wasi:: poll_oneoff ( & in_, & mut out) . unwrap ( ) } ;
51- let wasi:: Event { userdata, error, type_, .. } = out[ 0 ] ;
52- match ( n, userdata, error) {
53- ( 1 , CLOCK_ID , 0 ) if type_ == wasi:: EVENTTYPE_CLOCK => { }
49+ let ( res, event) = unsafe {
50+ let mut out: [ wasi:: Event ; 1 ] = mem:: zeroed ( ) ;
51+ let res = wasi:: poll_oneoff ( & in_, & mut out) ;
52+ ( res, out[ 0 ] )
53+ } ;
54+ match ( res, event) {
55+ ( Ok ( 1 ) , wasi:: Event {
56+ userdata : CLOCK_ID ,
57+ error : 0 ,
58+ type_ : wasi:: EVENTTYPE_CLOCK ,
59+ ..
60+ } ) => { }
5461 _ => panic ! ( "thread::sleep(): unexpected result of poll_oneoff" ) ,
5562 }
5663 }
You can’t perform that action at this time.
0 commit comments