Fix: Use _stop instead of _stop_event to match reference
Browse files
app.py
CHANGED
|
@@ -241,18 +241,18 @@ class FrameScheduler(threading.Thread):
|
|
| 241 |
self.n_steps = int(n_steps)
|
| 242 |
self.cfg = float(cfg)
|
| 243 |
self.clamp = bool(clamp)
|
| 244 |
-
self.
|
| 245 |
# FPS tracking
|
| 246 |
self.frame_times = []
|
| 247 |
self.last_frame_time = None
|
| 248 |
|
| 249 |
def stop(self):
|
| 250 |
-
self.
|
| 251 |
|
| 252 |
def run(self):
|
| 253 |
global frame_index, latest_action
|
| 254 |
next_tick = time.perf_counter()
|
| 255 |
-
while not self.
|
| 256 |
start = time.perf_counter()
|
| 257 |
if start - next_tick > self.frame_period * 0.75:
|
| 258 |
next_tick = start + self.frame_period
|
|
|
|
| 241 |
self.n_steps = int(n_steps)
|
| 242 |
self.cfg = float(cfg)
|
| 243 |
self.clamp = bool(clamp)
|
| 244 |
+
self._stop = threading.Event()
|
| 245 |
# FPS tracking
|
| 246 |
self.frame_times = []
|
| 247 |
self.last_frame_time = None
|
| 248 |
|
| 249 |
def stop(self):
|
| 250 |
+
self._stop.set()
|
| 251 |
|
| 252 |
def run(self):
|
| 253 |
global frame_index, latest_action
|
| 254 |
next_tick = time.perf_counter()
|
| 255 |
+
while not self._stop.is_set():
|
| 256 |
start = time.perf_counter()
|
| 257 |
if start - next_tick > self.frame_period * 0.75:
|
| 258 |
next_tick = start + self.frame_period
|