targets/Win32/plc_Win32_main.c
changeset 2174 55611282b909
parent 1903 084256be3658
child 3295 0375d801fff7
equal deleted inserted replaced
2173:976841968d74 2174:55611282b909
    52     {
    52     {
    53         printf("SetWaitableTimer failed (%d)\n", GetLastError());
    53         printf("SetWaitableTimer failed (%d)\n", GetLastError());
    54     }
    54     }
    55 }
    55 }
    56 
    56 
       
    57 int PLC_shutdown;
       
    58 
       
    59 int ForceSaveRetainReq(void) {
       
    60     return PLC_shutdown;
       
    61 }
       
    62 
    57 /* Variable used to stop plcloop thread */
    63 /* Variable used to stop plcloop thread */
    58 void PlcLoop()
    64 void PlcLoop()
    59 {
    65 {
    60     while(WaitForSingleObject(PLC_timer, INFINITE) == WAIT_OBJECT_0)
    66     PLC_shutdown = 0;
    61     {
    67     while(!PLC_shutdown) {
       
    68         if (WaitForSingleObject(PLC_timer, INFINITE) != WAIT_OBJECT_0)
       
    69             PLC_shutdown = 1;
    62         PLC_timer_notify();
    70         PLC_timer_notify();
    63     }
    71     }
    64 }
    72 }
    65 
    73 
    66 HANDLE PLC_thread;
    74 HANDLE PLC_thread;
   239 void LockPython(void)
   247 void LockPython(void)
   240 {
   248 {
   241 	WaitForSingleObject(python_sem, INFINITE);
   249 	WaitForSingleObject(python_sem, INFINITE);
   242 }
   250 }
   243 
   251 
   244 #ifndef HAVE_RETAIN
       
   245 void InitRetain(void)
       
   246 {
       
   247 }
       
   248 
       
   249 void CleanupRetain(void)
       
   250 {
       
   251 }
       
   252 
       
   253 int CheckRetainBuffer(void)
       
   254 {
       
   255 	return 1;
       
   256 }
       
   257 
       
   258 void ValidateRetainBuffer(void)
       
   259 {
       
   260 }
       
   261 
       
   262 void InValidateRetainBuffer(void)
       
   263 {
       
   264 }
       
   265 
       
   266 void Retain(unsigned int offset, unsigned int count, void * p)
       
   267 {
       
   268     /*
       
   269     unsigned int position;
       
   270     for(position=0; position<count; position++ ){
       
   271         printf("%d : 0x%2.2x\n", offset+position, ((char*)p)[position]);
       
   272     }
       
   273     */
       
   274 }
       
   275 
       
   276 void Remind(unsigned int offset, unsigned int count, void *p)
       
   277 {
       
   278 }
       
   279 #endif // !HAVE_RETAIN
       
   280 
       
   281 static void __attribute__((constructor))
   252 static void __attribute__((constructor))
   282 beremiz_dll_init(void)
   253 beremiz_dll_init(void)
   283 {
   254 {
   284     InitializeCriticalSection(&Atomic64CS);
   255     InitializeCriticalSection(&Atomic64CS);
   285 
   256