equal
deleted
inserted
replaced
73 int startPLC(int argc,char **argv) |
73 int startPLC(int argc,char **argv) |
74 { |
74 { |
75 unsigned long thread_id = 0; |
75 unsigned long thread_id = 0; |
76 BOOL tmp; |
76 BOOL tmp; |
77 setlocale(LC_NUMERIC, "C"); |
77 setlocale(LC_NUMERIC, "C"); |
78 |
|
79 InitializeCriticalSection(&Atomic64CS); |
|
80 |
78 |
81 debug_sem = CreateSemaphore( |
79 debug_sem = CreateSemaphore( |
82 NULL, // default security attributes |
80 NULL, // default security attributes |
83 1, // initial count |
81 1, // initial count |
84 1, // maximum count |
82 1, // maximum count |
168 int stopPLC() |
166 int stopPLC() |
169 { |
167 { |
170 CloseHandle(PLC_timer); |
168 CloseHandle(PLC_timer); |
171 WaitForSingleObject(PLC_thread, INFINITE); |
169 WaitForSingleObject(PLC_thread, INFINITE); |
172 __cleanup(); |
170 __cleanup(); |
173 DeleteCriticalSection(&Atomic64CS); |
|
174 CloseHandle(debug_wait_sem); |
171 CloseHandle(debug_wait_sem); |
175 CloseHandle(debug_sem); |
172 CloseHandle(debug_sem); |
176 CloseHandle(python_wait_sem); |
173 CloseHandle(python_wait_sem); |
177 CloseHandle(python_sem); |
174 CloseHandle(python_sem); |
178 CloseHandle(PLC_thread); |
175 CloseHandle(PLC_thread); |
277 |
274 |
278 void Remind(unsigned int offset, unsigned int count, void *p) |
275 void Remind(unsigned int offset, unsigned int count, void *p) |
279 { |
276 { |
280 } |
277 } |
281 |
278 |
|
279 static void __attribute__((constructor)) |
|
280 beremiz_dll_init(void) |
|
281 { |
|
282 ResetLogCount(); |
|
283 InitializeCriticalSection(&Atomic64CS); |
|
284 |
|
285 } |
|
286 |
|
287 static void __attribute__((destructor)) |
|
288 beremiz_dll_destroy(void) |
|
289 { |
|
290 DeleteCriticalSection(&Atomic64CS); |
|
291 } |
|
292 |