@@ -5,7 +5,6 @@ mod decl {
55 use std:: sync:: OnceLock ;
66 use std:: sync:: { Arc , atomic:: AtomicBool } ;
77 use std:: thread;
8- use std:: time:: Duration ;
98
109 use crate :: vm:: { PyObjectRef , PyResult } ;
1110 use num_traits:: ToPrimitive ;
@@ -133,8 +132,6 @@ mod decl {
133132 }
134133
135134 // Notify cancellation:
136- // Here we “release” the cancel_event by taking it out (dropping the lock)
137- // so that a waiting watchdog thread may proceed.
138135 wd. cancel_event = None ;
139136 drop ( wd) ;
140137
@@ -172,7 +169,7 @@ mod decl {
172169
173170 fn faulthandler_thread ( ) {
174171 // Take a snapshot of the needed watchdog state.
175- let ( _fd, timeout_us , exit, repeat, vm, header, cancel_event, running) = {
172+ let ( _fd, _timeout_us , exit, repeat, vm, header, cancel_event, running) = {
176173 let wd = get_watchdog ( ) . lock ( ) ;
177174 (
178175 wd. fd ,
@@ -189,9 +186,8 @@ mod decl {
189186 loop {
190187 // Try to acquire cancel_event with a timeout.
191188 let cancelled = if let Some ( ref cancel) = cancel_event {
192- // We assume that PyMutex (from rustpython_common::lock) is based on parking_lot
193- // and thus supports try_lock_for.
194- if let Some ( _guard) = cancel. try_lock_for ( Duration :: from_micros ( timeout_us) ) {
189+ // TODO: use try_lock_for instead
190+ if let Some ( _guard) = cancel. try_lock ( ) {
195191 // Cancel event acquired: thread cancellation was signaled.
196192 true
197193 } else {
0 commit comments