Skip to content

Commit

Permalink
ThreadBasedCyclicSendTask using WIN32 API cannot handle period smalle…
Browse files Browse the repository at this point in the history
…r than 1 ms (#1847)

Using a win32 SetWaitableTimer with a period of `0` means that the timer will only be signaled once. This will make the `ThreadBasedCyclicSendTask` to only send one message.
  • Loading branch information
pierreluctg authored Aug 29, 2024
1 parent e291874 commit c712131
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions can/broadcastmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ def __init__(

self.event: Optional[_Pywin32Event] = None
if PYWIN32:
if self.period_ms == 0:
# A period of 0 would mean that the timer is signaled only once
raise ValueError("The period cannot be smaller than 0.001 (1 ms)")
self.event = PYWIN32.create_timer()
elif (
sys.platform == "win32"
Expand Down

0 comments on commit c712131

Please sign in to comment.