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 {
42
42
#[ repr( C ) ]
43
43
#[ derive( Clone , Default ) ]
44
44
pub struct CPUAlarmVal {
45
+ #[ cfg( target_os = "linux" ) ]
45
46
pub cpu_alarms_tx : Arc < Mutex < Option < mpsc:: UnboundedSender < ( ) > > > > ,
46
47
}
47
48
@@ -131,9 +132,12 @@ impl CPUTimer {
131
132
132
133
pub async fn set_channel ( & self ) -> mpsc:: UnboundedReceiver < ( ) > {
133
134
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
+ }
135
140
136
- * val = Some ( tx) ;
137
141
rx
138
142
}
139
143
@@ -176,11 +180,6 @@ impl CPUTimer {
176
180
log:: error!( "CPU timer: not enabled (need Linux)" ) ;
177
181
Ok ( Self { } )
178
182
}
179
-
180
- #[ cfg( not( target_os = "linux" ) ) ]
181
- pub fn reset ( & self ) -> Result < ( ) , Error > {
182
- Ok ( ( ) )
183
- }
184
183
}
185
184
186
185
pub fn get_thread_time ( ) -> Result < i64 , Error > {
You can’t perform that action at this time.
0 commit comments