mirror of
https://github.com/bec-project/ophyd_devices.git
synced 2025-06-23 19:27:59 +02:00
fix(device base): shut down task handler on destroy
This commit is contained in:
@ -164,6 +164,7 @@ class PSIDeviceBase(Device):
|
||||
"""Destroy the device."""
|
||||
self.on_destroy() # Call the on_destroy method
|
||||
self._stop_stoppable_status_objects()
|
||||
self.task_handler.shutdown()
|
||||
return super().destroy()
|
||||
|
||||
########################################
|
||||
|
@ -155,7 +155,7 @@ class TaskHandler:
|
||||
task_status.set_finished()
|
||||
finally:
|
||||
with self._lock:
|
||||
self._tasks.pop(task_status.task_id)
|
||||
self._tasks.pop(task_status.task_id, None)
|
||||
|
||||
def kill_task(self, task_status: TaskStatus) -> None:
|
||||
"""Kill the thread
|
||||
@ -171,7 +171,7 @@ class TaskHandler:
|
||||
res = set_async_exc(ident, exc)
|
||||
if res == 0:
|
||||
raise ValueError("Invalid thread ID")
|
||||
elif res > 1:
|
||||
if res > 1:
|
||||
set_async_exc(ident, None)
|
||||
logger.warning(f"Exception raise while kille Thread {ident}; return value: {res}")
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
|
Reference in New Issue
Block a user