equal
deleted
inserted
replaced
3 #include <time.h> |
3 #include <time.h> |
4 #include <signal.h> |
4 #include <signal.h> |
5 #include <stdlib.h> |
5 #include <stdlib.h> |
6 #include <pthread.h> |
6 #include <pthread.h> |
7 |
7 |
8 long AtomicCompareExchange(long* atomicvar,long exchange, long compared) |
8 long AtomicCompareExchange(long* atomicvar,long compared, long exchange) |
9 { |
9 { |
10 return __sync_val_compare_and_swap(atomicvar, compared, exchange); |
10 return __sync_val_compare_and_swap(atomicvar, compared, exchange); |
11 } |
11 } |
12 |
12 |
13 //long AtomicExchange(long* atomicvar,long exchange) |
13 //long AtomicExchange(long* atomicvar,long exchange) |
93 |
93 |
94 void AbortDebug() |
94 void AbortDebug() |
95 { |
95 { |
96 /* Eventually unlock debugger thread*/ |
96 /* Eventually unlock debugger thread*/ |
97 __debug_tick = -1; |
97 __debug_tick = -1; |
98 pthread_mutex_lock(&wait_mutex); |
98 //pthread_mutex_lock(&wait_mutex); |
99 pthread_cond_broadcast(&wait_cond); |
99 pthread_cond_broadcast(&wait_cond); |
100 pthread_mutex_unlock(&wait_mutex); |
100 //pthread_mutex_unlock(&wait_mutex); |
101 } |
101 } |
102 |
102 |
103 int stopPLC() |
103 int stopPLC() |
104 { |
104 { |
105 /* Stop the PLC */ |
105 /* Stop the PLC */ |
124 * This is supposed to unlock debugger thread in WaitDebugData*/ |
124 * This is supposed to unlock debugger thread in WaitDebugData*/ |
125 void InitiateDebugTransfer() |
125 void InitiateDebugTransfer() |
126 { |
126 { |
127 /* signal debugger thread to continue*/ |
127 /* signal debugger thread to continue*/ |
128 __debug_tick = __tick; |
128 __debug_tick = __tick; |
129 pthread_mutex_lock(&wait_mutex); |
129 //pthread_mutex_lock(&wait_mutex); |
130 pthread_cond_broadcast(&wait_cond); |
130 pthread_cond_broadcast(&wait_cond); |
131 pthread_mutex_unlock(&wait_mutex); |
131 //pthread_mutex_unlock(&wait_mutex); |
132 } |
132 } |