Skip to content

Commit 78c0db3

Browse files
authored
Calling stop_all_periodic_tasks() in BusABC (#1174)
Currently, only socketcan is calling stop_all_periodic_tasks() on shutdown and respecting the fact that periodic tasks should be stopped on Bus instance shutdown (according to BusABC.send_periodic docstring).
1 parent 38b1b0d commit 78c0db3

File tree

19 files changed

+19
-1
lines changed

19 files changed

+19
-1
lines changed

can/bus.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ def shutdown(self) -> None:
411411
Called to carry out any interface specific cleanup required
412412
in shutting down a bus.
413413
"""
414+
self.stop_all_periodic_tasks()
414415

415416
def __enter__(self):
416417
return self

can/interfaces/canalystii.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ def flush_tx_buffer(self, channel: Optional[int] = None) -> None:
204204
self.device.flush_tx_buffer(ch, float("infinity"))
205205

206206
def shutdown(self) -> None:
207+
super().shutdown()
207208
for channel in self.channels:
208209
self.device.stop(channel)
209210
self.device = None

can/interfaces/cantact.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def send(self, msg, timeout=None):
131131
)
132132

133133
def shutdown(self):
134+
super().shutdown()
134135
with error_check("Cannot shutdown interface"):
135136
self.interface.stop()
136137

can/interfaces/gs_usb.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,5 @@ def _recv_internal(
112112
return msg, False
113113

114114
def shutdown(self):
115+
super().shutdown()
115116
self.gs_usb.stop()

can/interfaces/iscan.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def send(self, msg: Message, timeout: Optional[float] = None) -> None:
152152
iscan.isCAN_TransmitMessageEx(self.channel, ctypes.byref(raw_msg))
153153

154154
def shutdown(self) -> None:
155+
super().shutdown()
155156
iscan.isCAN_CloseDevice(self.channel)
156157

157158

can/interfaces/kvaser/canlib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ def flash(self, flash=True):
643643
log.error("Could not flash LEDs (%s)", e)
644644

645645
def shutdown(self):
646+
super().shutdown()
646647
# Wait for transmit queue to be cleared
647648
try:
648649
canWriteSync(self._write_handle, 100)

can/interfaces/neousys/neousys.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ def _neousys_status_cb(self, status) -> None:
233233
logger.info("%s _neousys_status_cb: %d", self.init_config, status)
234234

235235
def shutdown(self):
236+
super().shutdown()
236237
NEOUSYS_CANLIB.CAN_Stop(self.channel)
237238

238239
@staticmethod

can/interfaces/nican.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,4 +375,5 @@ def reset(self) -> None:
375375

376376
def shutdown(self) -> None:
377377
"""Close object."""
378+
super().shutdown()
378379
nican.ncCloseObject(self.handle)

can/interfaces/nixnet.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ def reset(self):
221221

222222
def shutdown(self):
223223
"""Close object."""
224+
super().shutdown()
224225
self.__session_send.flush()
225226
self.__session_receive.flush()
226227

can/interfaces/robotell.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ def send(self, msg, timeout=None):
367367
)
368368

369369
def shutdown(self):
370+
super().shutdown()
370371
self.serialPortOrig.close()
371372

372373
def fileno(self):

0 commit comments

Comments
 (0)