@@ -347,7 +347,7 @@ enum Timeout {
347
347
348
348
impl Timeout {
349
349
/// How long do we have to wait from now until the specified time?
350
- fn get_wait_time ( & self , clock : & Clock ) -> Duration {
350
+ fn get_wait_time ( & self , clock : & MonotonicClock ) -> Duration {
351
351
match self {
352
352
Timeout :: Monotonic ( instant) => instant. duration_since ( clock. now ( ) ) ,
353
353
Timeout :: RealTime ( time) =>
@@ -683,7 +683,7 @@ impl<'tcx> ThreadManager<'tcx> {
683
683
}
684
684
685
685
/// Get the wait time for the next timeout, or `None` if no timeout is pending.
686
- fn next_callback_wait_time ( & self , clock : & Clock ) -> Option < Duration > {
686
+ fn next_callback_wait_time ( & self , clock : & MonotonicClock ) -> Option < Duration > {
687
687
self . threads
688
688
. iter ( )
689
689
. filter_map ( |t| {
@@ -702,7 +702,7 @@ impl<'tcx> ThreadManager<'tcx> {
702
702
/// used in stateless model checkers such as Loom: run the active thread as
703
703
/// long as we can and switch only when we have to (the active thread was
704
704
/// blocked, terminated, or has explicitly asked to be preempted).
705
- fn schedule ( & mut self , clock : & Clock ) -> InterpResult < ' tcx , SchedulingAction > {
705
+ fn schedule ( & mut self , clock : & MonotonicClock ) -> InterpResult < ' tcx , SchedulingAction > {
706
706
// This thread and the program can keep going.
707
707
if self . threads [ self . active_thread ] . state . is_enabled ( ) && !self . yield_active_thread {
708
708
// The currently active thread is still enabled, just continue with it.
@@ -772,7 +772,7 @@ trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> {
772
772
for ( id, thread) in this. machine . threads . threads . iter_enumerated_mut ( ) {
773
773
match & thread. state {
774
774
ThreadState :: Blocked { timeout : Some ( timeout) , .. }
775
- if timeout. get_wait_time ( & this. machine . clock ) == Duration :: ZERO =>
775
+ if timeout. get_wait_time ( & this. machine . monotonic_clock ) == Duration :: ZERO =>
776
776
{
777
777
let old_state = mem:: replace ( & mut thread. state , ThreadState :: Enabled ) ;
778
778
let ThreadState :: Blocked { callback, .. } = old_state else { unreachable ! ( ) } ;
@@ -1006,8 +1006,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1006
1006
}
1007
1007
TimeoutClock :: Monotonic =>
1008
1008
Timeout :: Monotonic ( match anchor {
1009
- TimeoutAnchor :: Absolute => this. machine . clock . epoch ( ) ,
1010
- TimeoutAnchor :: Relative => this. machine . clock . now ( ) ,
1009
+ TimeoutAnchor :: Absolute => this. machine . monotonic_clock . epoch ( ) ,
1010
+ TimeoutAnchor :: Relative => this. machine . monotonic_clock . now ( ) ,
1011
1011
} ) ,
1012
1012
} ;
1013
1013
anchor. add_lossy ( duration)
@@ -1152,7 +1152,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1152
1152
this. machine . handle_abnormal_termination ( ) ;
1153
1153
throw_machine_stop ! ( TerminationInfo :: Interrupted ) ;
1154
1154
}
1155
- match this. machine . threads . schedule ( & this. machine . clock ) ? {
1155
+ match this. machine . threads . schedule ( & this. machine . monotonic_clock ) ? {
1156
1156
SchedulingAction :: ExecuteStep => {
1157
1157
if !this. step ( ) ? {
1158
1158
// See if this thread can do something else.
@@ -1167,7 +1167,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1167
1167
this. run_timeout_callback ( ) ?;
1168
1168
}
1169
1169
SchedulingAction :: Sleep ( duration) => {
1170
- this. machine . clock . sleep ( duration) ;
1170
+ this. machine . monotonic_clock . sleep ( duration) ;
1171
1171
}
1172
1172
}
1173
1173
}
0 commit comments