mirror of
https://github.com/naruxde/revpimodio2.git
synced 2025-11-08 22:03:53 +01:00
style: With shared_procimg, save changed outputs in set instead of list
In sets, elements can only occur once. Therefore, no `if` statement has to check whether the element is already included in the list. Signed-off-by: Sven Sager <akira@narux.de>
This commit is contained in:
@@ -3,4 +3,4 @@
|
|||||||
__author__ = "Sven Sager <akira@revpimodio.org>"
|
__author__ = "Sven Sager <akira@revpimodio.org>"
|
||||||
__copyright__ = "Copyright (C) 2023 Sven Sager"
|
__copyright__ = "Copyright (C) 2023 Sven Sager"
|
||||||
__license__ = "LGPLv2"
|
__license__ = "LGPLv2"
|
||||||
__version__ = "2.6.0"
|
__version__ = "2.6.1rc1"
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ class Device(object):
|
|||||||
self.__my_io_list = []
|
self.__my_io_list = []
|
||||||
self._selfupdate = False
|
self._selfupdate = False
|
||||||
self._shared_procimg = False
|
self._shared_procimg = False
|
||||||
self._shared_write = []
|
self._shared_write = set()
|
||||||
self.shared_procimg(parentmodio._shared_procimg) # Set with register
|
self.shared_procimg(parentmodio._shared_procimg) # Set with register
|
||||||
|
|
||||||
# Wertzuweisung aus dict_device
|
# Wertzuweisung aus dict_device
|
||||||
|
|||||||
@@ -706,10 +706,9 @@ class IOBase(object):
|
|||||||
# Für Bitoperationen sperren
|
# Für Bitoperationen sperren
|
||||||
self._parentdevice._filelock.acquire()
|
self._parentdevice._filelock.acquire()
|
||||||
|
|
||||||
if self._parentdevice._shared_procimg \
|
if self._parentdevice._shared_procimg:
|
||||||
and self not in self._parentdevice._shared_write:
|
|
||||||
# Mark this IO for write operations
|
# Mark this IO for write operations
|
||||||
self._parentdevice._shared_write.append(self)
|
self._parentdevice._shared_write.add(self)
|
||||||
|
|
||||||
# Hier gibt es immer nur ein byte, als int holen
|
# Hier gibt es immer nur ein byte, als int holen
|
||||||
int_byte = self._parentdevice._ba_devdata[self._slc_address.start]
|
int_byte = self._parentdevice._ba_devdata[self._slc_address.start]
|
||||||
@@ -743,11 +742,10 @@ class IOBase(object):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if self._parentdevice._shared_procimg \
|
if self._parentdevice._shared_procimg:
|
||||||
and self not in self._parentdevice._shared_write:
|
|
||||||
with self._parentdevice._filelock:
|
with self._parentdevice._filelock:
|
||||||
# Mark this IO as changed
|
# Mark this IO as changed
|
||||||
self._parentdevice._shared_write.append(self)
|
self._parentdevice._shared_write.add(self)
|
||||||
|
|
||||||
self._parentdevice._ba_devdata[self._slc_address] = value
|
self._parentdevice._ba_devdata[self._slc_address] = value
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user