--- a/targets/Win32/plc_Win32_main.c Fri Sep 29 13:45:50 2023 +0200
+++ b/targets/Win32/plc_Win32_main.c Fri Sep 29 13:46:36 2023 +0200
@@ -35,12 +35,6 @@
(*CURRENT_TIME).tv_nsec = timetmp.millitm * 1000000;
- PLC_GetTime(&__CURRENT_TIME);
void PLC_SetTimer(unsigned long long next, unsigned long long period)
@@ -65,9 +59,12 @@
- if (WaitForSingleObject(PLC_timer, INFINITE) != WAIT_OBJECT_0)
+ if (WaitForSingleObject(PLC_timer, INFINITE) != WAIT_OBJECT_0){
+ PLC_GetTime(&__CURRENT_TIME); @@ -172,9 +169,16 @@
- CloseHandle(PLC_timer);
+ // force last wakeup of PLC thread + SetWaitableTimer(PLC_timer, 0, 0, NULL, NULL, 0); + // wait end of PLC thread WaitForSingleObject(PLC_thread, INFINITE);
+ CloseHandle(PLC_timer); CloseHandle(debug_wait_sem);
CloseHandle(python_wait_sem);