targets/Win32/plc_Win32_main.c
changeset 985 cd8dadcef426
parent 954 ab487d32ce9a
child 1428 e14003eb4d42
equal deleted inserted replaced
984:2d03056993f6 985:cd8dadcef426
     6 #include <sys/timeb.h>
     6 #include <sys/timeb.h>
     7 #include <time.h>
     7 #include <time.h>
     8 #include <windows.h>
     8 #include <windows.h>
     9 #include <locale.h>
     9 #include <locale.h>
    10 
    10 
    11 /* provided by POUS.C */
       
    12 extern unsigned long long common_ticktime__;
       
    13 
    11 
    14 long AtomicCompareExchange(long* atomicvar, long compared, long exchange)
    12 long AtomicCompareExchange(long* atomicvar, long compared, long exchange)
    15 {
    13 {
    16     return InterlockedCompareExchange(atomicvar, exchange, compared);
    14     return InterlockedCompareExchange(atomicvar, exchange, compared);
    17 }
    15 }
    75 int startPLC(int argc,char **argv)
    73 int startPLC(int argc,char **argv)
    76 {
    74 {
    77 	unsigned long thread_id = 0;
    75 	unsigned long thread_id = 0;
    78     BOOL tmp;
    76     BOOL tmp;
    79     setlocale(LC_NUMERIC, "C");
    77     setlocale(LC_NUMERIC, "C");
    80 	/* Define Ttick to 1ms if common_ticktime not defined */
       
    81     Ttick = common_ticktime__?common_ticktime__:1000000;
       
    82 
    78 
    83     InitializeCriticalSection(&Atomic64CS);
    79     InitializeCriticalSection(&Atomic64CS);
    84 
    80 
    85     debug_sem = CreateSemaphore(
    81     debug_sem = CreateSemaphore(
    86                             NULL,           // default security attributes
    82                             NULL,           // default security attributes