@@ -347,7 +347,7 @@ enum Timeout {
347347
348348impl Timeout {
349349 /// 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 {
351351 match self {
352352 Timeout :: Monotonic ( instant) => instant. duration_since ( clock. now ( ) ) ,
353353 Timeout :: RealTime ( time) =>
@@ -683,7 +683,7 @@ impl<'tcx> ThreadManager<'tcx> {
683683 }
684684
685685 /// 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 > {
687687 self . threads
688688 . iter ( )
689689 . filter_map ( |t| {
@@ -702,7 +702,7 @@ impl<'tcx> ThreadManager<'tcx> {
702702 /// used in stateless model checkers such as Loom: run the active thread as
703703 /// long as we can and switch only when we have to (the active thread was
704704 /// 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 > {
706706 // This thread and the program can keep going.
707707 if self . threads [ self . active_thread ] . state . is_enabled ( ) && !self . yield_active_thread {
708708 // The currently active thread is still enabled, just continue with it.
@@ -772,7 +772,7 @@ trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> {
772772 for ( id, thread) in this. machine . threads . threads . iter_enumerated_mut ( ) {
773773 match & thread. state {
774774 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 =>
776776 {
777777 let old_state = mem:: replace ( & mut thread. state , ThreadState :: Enabled ) ;
778778 let ThreadState :: Blocked { callback, .. } = old_state else { unreachable ! ( ) } ;
@@ -1006,8 +1006,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
10061006 }
10071007 TimeoutClock :: Monotonic =>
10081008 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 ( ) ,
10111011 } ) ,
10121012 } ;
10131013 anchor. add_lossy ( duration)
@@ -1152,7 +1152,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
11521152 this. machine . handle_abnormal_termination ( ) ;
11531153 throw_machine_stop ! ( TerminationInfo :: Interrupted ) ;
11541154 }
1155- match this. machine . threads . schedule ( & this. machine . clock ) ? {
1155+ match this. machine . threads . schedule ( & this. machine . monotonic_clock ) ? {
11561156 SchedulingAction :: ExecuteStep => {
11571157 if !this. step ( ) ? {
11581158 // See if this thread can do something else.
@@ -1167,7 +1167,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
11671167 this. run_timeout_callback ( ) ?;
11681168 }
11691169 SchedulingAction :: Sleep ( duration) => {
1170- this. machine . clock . sleep ( duration) ;
1170+ this. machine . monotonic_clock . sleep ( duration) ;
11711171 }
11721172 }
11731173 }
0 commit comments