--- a/runtime/PLCObject.py Sun Dec 06 15:54:22 2009 +0100
+++ b/runtime/PLCObject.py Sun Dec 06 15:55:56 2009 +0100
@@ -95,8 +95,8 @@
self._startPLC.restype = ctypes.c_int
self._startPLC.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_char_p)]
- self.DummyIteratorLock = Lock()
- self.DummyIteratorLock.acquire()
+ self._stopPLC_real = self.PLClibraryHandle.stopPLC + self._stopPLC_real.restype = None self._PythonIterator = getattr(self.PLClibraryHandle, "PythonIterator", None)
if self._PythonIterator is not None:
@@ -105,24 +105,27 @@
self.PLClibraryLock.acquire()
- self.PLClibraryHandle.stopPLC()
self.PLClibraryLock.release()
- def DummyIterator(res):
- self.DummyIteratorLock.acquire()
- self.DummyIteratorLock.release()
+ # If python plugin is not enabled, we reuse _PythonIterator + # as a call that block pythonthread until StopPLC + self.PythonIteratorLock = Lock() + self.PythonIteratorLock.acquire() + def PythonIterator(res): + self.PythonIteratorLock.acquire() + self.PythonIteratorLock.release() - self._PythonIterator = DummyIterator
+ self._PythonIterator = PythonIterator self.PLClibraryLock.acquire()
- self.PLClibraryHandle.stopPLC()
- self.DummyIteratorLock.release()
+ self.PythonIteratorLock.release() self.PLClibraryLock.release()
self._stopPLC = StopPLCLock
- self._stopPLC.restype = None
self._ResetDebugVariables = self.PLClibraryHandle.ResetDebugVariables
self._ResetDebugVariables.restype = None
@@ -374,6 +377,7 @@
Return a list of variables, corresponding to the list of required idx
if self.PLCStatus == "Started":
self.PLClibraryLock.acquire()