targets/Linux/plc_Linux_main.c
changeset 985 cd8dadcef426
parent 954 ab487d32ce9a
child 1428 e14003eb4d42
equal deleted inserted replaced
984:2d03056993f6 985:cd8dadcef426
     9 #include <stdlib.h>
     9 #include <stdlib.h>
    10 #include <pthread.h>
    10 #include <pthread.h>
    11 #include <locale.h>
    11 #include <locale.h>
    12 #include <semaphore.h>
    12 #include <semaphore.h>
    13 
    13 
    14 extern unsigned long long common_ticktime__;
       
    15 static sem_t Run_PLC;
    14 static sem_t Run_PLC;
    16 
    15 
    17 long AtomicCompareExchange(long* atomicvar,long compared, long exchange)
    16 long AtomicCompareExchange(long* atomicvar,long compared, long exchange)
    18 {
    17 {
    19     return __sync_val_compare_and_swap(atomicvar, compared, exchange);
    18     return __sync_val_compare_and_swap(atomicvar, compared, exchange);
    95 #define maxval(a,b) ((a>b)?a:b)
    94 #define maxval(a,b) ((a>b)?a:b)
    96 int startPLC(int argc,char **argv)
    95 int startPLC(int argc,char **argv)
    97 {
    96 {
    98     struct sigevent sigev;
    97     struct sigevent sigev;
    99     setlocale(LC_NUMERIC, "C");
    98     setlocale(LC_NUMERIC, "C");
   100     /* Define Ttick to 1ms if common_ticktime not defined */
       
   101     Ttick = common_ticktime__?common_ticktime__:1000000;
       
   102 
    99 
   103     PLC_shutdown = 0;
   100     PLC_shutdown = 0;
   104 
   101 
   105     sem_init(&Run_PLC, 0, 0);
   102     sem_init(&Run_PLC, 0, 0);
   106 
   103