mirror of
https://github.com/naruxde/revpimodio2.git
synced 2025-11-08 22:03:53 +01:00
Lock des replace_io bei Verwendung von replace_io_file entfernt
This commit is contained in:
@@ -1000,13 +1000,6 @@ class IntIOReplaceable(IntIO):
|
|||||||
>Python3 struct</a>
|
>Python3 struct</a>
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Sperre prüfen
|
|
||||||
if self._parentdevice._modio._lck_replace_io:
|
|
||||||
raise RuntimeError(
|
|
||||||
"can not use this function while using an external "
|
|
||||||
"replace_io_file"
|
|
||||||
)
|
|
||||||
|
|
||||||
# StructIO erzeugen
|
# StructIO erzeugen
|
||||||
io_new = StructIO(
|
io_new = StructIO(
|
||||||
self,
|
self,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class RevPiModIO(object):
|
|||||||
"_maxioerrors", "_myfh", "_myfh_lck", "_monitoring", "_procimg", \
|
"_maxioerrors", "_myfh", "_myfh_lck", "_monitoring", "_procimg", \
|
||||||
"_simulator", "_syncoutputs", "_th_mainloop", "_waitexit", \
|
"_simulator", "_syncoutputs", "_th_mainloop", "_waitexit", \
|
||||||
"core", "app", "device", "exitsignal", "io", "summary", "_debug", \
|
"core", "app", "device", "exitsignal", "io", "summary", "_debug", \
|
||||||
"_lck_replace_io", "_replace_io_file", "_run_on_pi"
|
"_replace_io_file", "_run_on_pi"
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, autorefresh=False, monitoring=False, syncoutputs=True,
|
self, autorefresh=False, monitoring=False, syncoutputs=True,
|
||||||
@@ -85,7 +85,6 @@ class RevPiModIO(object):
|
|||||||
self._imgwriter = None
|
self._imgwriter = None
|
||||||
self._ioerror = 0
|
self._ioerror = 0
|
||||||
self._length = 0
|
self._length = 0
|
||||||
self._lck_replace_io = False
|
|
||||||
self._looprunning = False
|
self._looprunning = False
|
||||||
self._lst_devselect = []
|
self._lst_devselect = []
|
||||||
self._lst_refresh = []
|
self._lst_refresh = []
|
||||||
@@ -308,8 +307,6 @@ class RevPiModIO(object):
|
|||||||
@param ireplaceio: Data to replace ios as <class 'ConfigParser'>
|
@param ireplaceio: Data to replace ios as <class 'ConfigParser'>
|
||||||
|
|
||||||
"""
|
"""
|
||||||
need_replace_lock = False
|
|
||||||
|
|
||||||
for io in creplaceio:
|
for io in creplaceio:
|
||||||
if io == "DEFAULT":
|
if io == "DEFAULT":
|
||||||
continue
|
continue
|
||||||
@@ -365,16 +362,12 @@ class RevPiModIO(object):
|
|||||||
# IO ersetzen
|
# IO ersetzen
|
||||||
try:
|
try:
|
||||||
self.io[parentio].replace_io(name=io, **dict_replace)
|
self.io[parentio].replace_io(name=io, **dict_replace)
|
||||||
need_replace_lock = True
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"replace_io_file: can not replace '{0}' with '{1}' "
|
"replace_io_file: can not replace '{0}' with '{1}' "
|
||||||
"| RevPiModIO message: {2}".format(parentio, io, e)
|
"| RevPiModIO message: {2}".format(parentio, io, e)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Sperre für weiter .replace_io Aufrufe setzen
|
|
||||||
self._lck_replace_io = need_replace_lock
|
|
||||||
|
|
||||||
def _create_myfh(self):
|
def _create_myfh(self):
|
||||||
"""Erstellt FileObject mit Pfad zum procimg.
|
"""Erstellt FileObject mit Pfad zum procimg.
|
||||||
return FileObject"""
|
return FileObject"""
|
||||||
|
|||||||
@@ -582,8 +582,8 @@ class RevPiNetIO(_RevPiModIO):
|
|||||||
configrsc=None,
|
configrsc=None,
|
||||||
simulator=simulator,
|
simulator=simulator,
|
||||||
debug=debug,
|
debug=debug,
|
||||||
replace_io_file=replace_io_file
|
replace_io_file=replace_io_file,
|
||||||
direct_output
|
direct_output=direct_output,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Netzwerkfilehandler anlegen
|
# Netzwerkfilehandler anlegen
|
||||||
|
|||||||
Reference in New Issue
Block a user