File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ mod linux {
4242#[ repr( C ) ]
4343#[ derive( Clone , Default ) ]
4444pub struct CPUAlarmVal {
45+ #[ cfg( target_os = "linux" ) ]
4546 pub cpu_alarms_tx : Arc < Mutex < Option < mpsc:: UnboundedSender < ( ) > > > > ,
4647}
4748
@@ -131,9 +132,12 @@ impl CPUTimer {
131132
132133 pub async fn set_channel ( & self ) -> mpsc:: UnboundedReceiver < ( ) > {
133134 let ( tx, rx) = mpsc:: unbounded_channel ( ) ;
134- let mut val = self . cpu_alarm_val . cpu_alarms_tx . lock ( ) . await ;
135+ #[ cfg( target_os = "linux" ) ]
136+ {
137+ let mut val = self . cpu_alarm_val . cpu_alarms_tx . lock ( ) . await ;
138+ * val = Some ( tx) ;
139+ }
135140
136- * val = Some ( tx) ;
137141 rx
138142 }
139143
@@ -176,11 +180,6 @@ impl CPUTimer {
176180 log:: error!( "CPU timer: not enabled (need Linux)" ) ;
177181 Ok ( Self { } )
178182 }
179-
180- #[ cfg( not( target_os = "linux" ) ) ]
181- pub fn reset ( & self ) -> Result < ( ) , Error > {
182- Ok ( ( ) )
183- }
184183}
185184
186185pub fn get_thread_time ( ) -> Result < i64 , Error > {
You can’t perform that action at this time.
0 commit comments