--- a/runtime/PLCObject.py Mon Apr 16 11:00:04 2018 +0200
+++ b/runtime/PLCObject.py Mon Apr 16 16:11:18 2018 +0200
@@ -459,10 +459,8 @@
res, cmd, blkid = "None", "None", ctypes.c_void_p()
- # print "_PythonIterator(", res, ")",
cmd = self._PythonIterator(res, blkid)
- # print " -> ", cmd, blkid
@@ -655,13 +653,18 @@
if self.PLClibraryLock.acquire(False):
- if self._GetDebugData(ctypes.byref(tick),
- ctypes.byref(buff)) == 0:
+ res = self._GetDebugData(ctypes.byref(tick), TraceBuffer = ctypes.string_at(buff.value, size.value)
self.PLClibraryLock.release()
if TraceBuffer is not None:
self._TracesPush((tick.value, TraceBuffer))
self._TracesAutoSuspend()
--- a/targets/Xenomai/plc_Xenomai_main.c Mon Apr 16 11:00:04 2018 +0200
+++ b/targets/Xenomai/plc_Xenomai_main.c Mon Apr 16 16:11:18 2018 +0200
@@ -37,6 +37,15 @@
#define PYTHON_PIPE_MINOR 3
+#define PYTHON_PENDING_COMMAND 1 +#define DEBUG_PENDING_DATA 1 long AtomicCompareExchange(long* atomicvar,long compared, long exchange)
@@ -82,6 +91,18 @@
rt_task_wait_period(NULL);
+ /* since xenomai 3 it is not enough to close() + file descriptor to unblock read()... */ + /* explicitely finish python thread */ + char msg = PYTHON_FINISH; + rt_pipe_write(&WaitPython_pipe, &msg, sizeof(msg), P_NORMAL); + /* explicitely finish debug thread */ + char msg = DEBUG_FINISH; + rt_pipe_write(&WaitDebug_pipe, &msg, sizeof(msg), P_NORMAL); static unsigned long __debug_tick;
@@ -256,7 +277,6 @@
void LeaveDebugSection(void)
if(AtomicCompareExchange( &debug_state,
@@ -269,7 +289,6 @@
extern unsigned long __tick;
-#define DEBUG_PENDING_DATA 1
int WaitDebugData(unsigned long *tick)
@@ -319,8 +338,6 @@
AtomicCompareExchange( &debug_state, DEBUG_BUSY, DEBUG_FREE);
-#define PYTHON_PENDING_COMMAND 1
static long python_state = PYTHON_FREE;