Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbruno25 committed Dec 26, 2023
1 parent dbf7332 commit 8e3792b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions can/broadcastmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ def _run(self) -> None:
win32event.WaitForSingleObject(self.event.handle, 0)

while not self.stopped:
if not USE_WINDOWS_EVENTS:
msg_due_time_ns += self.period_ns
if self.end_time is not None and time.perf_counter() >= self.end_time:
break
msg_index = (msg_index + 1) % len(self.messages)

# Prevent calling bus.send from multiple threads
with self.send_lock:
try:
Expand All @@ -316,12 +322,6 @@ def _run(self) -> None:
self.stop()
break

if not USE_WINDOWS_EVENTS:
msg_due_time_ns += self.period_ns
if self.end_time is not None and time.perf_counter() >= self.end_time:
break
msg_index = (msg_index + 1) % len(self.messages)

if USE_WINDOWS_EVENTS:
win32event.WaitForSingleObject(
self.event.handle,
Expand Down

0 comments on commit 8e3792b

Please sign in to comment.