--- a/targets/Linux/plc_Linux_main.c Sun Sep 25 22:51:51 2011 +0200
+++ b/targets/Linux/plc_Linux_main.c Mon Sep 26 00:24:04 2011 +0200
@@ -142,9 +142,11 @@
int WaitDebugData(unsigned long *tick)
{
+ int res;
+ /* Wait signal from PLC thread */
+ res = pthread_mutex_lock(&debug_wait_mutex);
*tick = __debug_tick;
- /* Wait signal from PLC thread */
- return pthread_mutex_lock(&debug_wait_mutex);
+ return res;
}
/* Called by PLC thread when debug_publish finished
--- a/targets/Xenomai/plc_Xenomai_main.c Sun Sep 25 22:51:51 2011 +0200
+++ b/targets/Xenomai/plc_Xenomai_main.c Mon Sep 26 00:24:04 2011 +0200
@@ -256,11 +256,12 @@
{
char cmd;
int res;
- *tick = __debug_tick;
/* Wait signal from PLC thread */
res = read(WaitDebug_pipe_fd, &cmd, sizeof(cmd));
- if (res == sizeof(cmd) && cmd == DEBUG_PENDING_DATA)
+ if (res == sizeof(cmd) && cmd == DEBUG_PENDING_DATA){
+ *tick = __debug_tick;
return 0;
+ }
return -1;
}
@@ -288,6 +289,8 @@
}
}
__DEBUG = !disable;
+ if (disable)
+ AtomicCompareExchange( &debug_state, DEBUG_BUSY, DEBUG_FREE);
return 0;
}