equal
deleted
inserted
replaced
8 #include <signal.h> |
8 #include <signal.h> |
9 #include <stdlib.h> |
9 #include <stdlib.h> |
10 #include <pthread.h> |
10 #include <pthread.h> |
11 #include <locale.h> |
11 #include <locale.h> |
12 |
12 |
13 /* provided by POUS.C */ |
|
14 extern unsigned long long common_ticktime__; |
13 extern unsigned long long common_ticktime__; |
15 |
14 |
16 long AtomicCompareExchange(long* atomicvar,long compared, long exchange) |
15 long AtomicCompareExchange(long* atomicvar,long compared, long exchange) |
17 { |
16 { |
18 return __sync_val_compare_and_swap(atomicvar, compared, exchange); |
17 return __sync_val_compare_and_swap(atomicvar, compared, exchange); |
156 __debug_tick = __tick; |
155 __debug_tick = __tick; |
157 /* signal debugger thread it can read data */ |
156 /* signal debugger thread it can read data */ |
158 pthread_mutex_unlock(&debug_wait_mutex); |
157 pthread_mutex_unlock(&debug_wait_mutex); |
159 } |
158 } |
160 |
159 |
161 void suspendDebug(int disable) |
160 int suspendDebug(int disable) |
162 { |
161 { |
163 /* Prevent PLC to enter debug code */ |
162 /* Prevent PLC to enter debug code */ |
164 pthread_mutex_lock(&debug_mutex); |
163 pthread_mutex_lock(&debug_mutex); |
165 /*__DEBUG is protected by this mutex */ |
164 /*__DEBUG is protected by this mutex */ |
166 __DEBUG = !disable; |
165 __DEBUG = !disable; |
167 if (disable) |
166 if (disable) |
168 pthread_mutex_unlock(&debug_mutex); |
167 pthread_mutex_unlock(&debug_mutex); |
|
168 return 0; |
169 } |
169 } |
170 |
170 |
171 void resumeDebug(void) |
171 void resumeDebug(void) |
172 { |
172 { |
173 __DEBUG = 1; |
173 __DEBUG = 1; |