runtime/plc_Win32_main.c
changeset 57 3b53f9a509d9
parent 49 45dc6a944ab6
child 75 9ad18a387a96
equal deleted inserted replaced
56:b0555fa71812 57:3b53f9a509d9
    26     {
    26     {
    27         printf("CreateWaitableTimer failed (%d)\n", GetLastError());
    27         printf("CreateWaitableTimer failed (%d)\n", GetLastError());
    28         return 1;
    28         return 1;
    29     }
    29     }
    30 
    30 
    31     __init();
    31     if( __init(argc,argv) == 0 ){
    32 
    32 
    33     // Set a timer to wait for 10 seconds.
    33         // Set a timer
    34     if (!SetWaitableTimer(hTimer, &liDueTime, common_ticktime__, NULL, NULL, 0))
    34         if (!SetWaitableTimer(hTimer, &liDueTime, common_ticktime__, NULL, NULL, 0))
    35     {
    35         {
    36         printf("SetWaitableTimer failed (%d)\n", GetLastError());
    36             printf("SetWaitableTimer failed (%d)\n", GetLastError());
    37         return 2;
    37             return 2;
       
    38         }
       
    39     
       
    40         while(1){
       
    41         // Wait for the timer.
       
    42             if (WaitForSingleObject(hTimer, INFINITE) != WAIT_OBJECT_0)
       
    43             {
       
    44                 printf("WaitForSingleObject failed (%d)\n", GetLastError());
       
    45                 break;
       
    46             }
       
    47             timer_notify();
       
    48         }
    38     }
    49     }
    39 
       
    40     while(1){
       
    41     // Wait for the timer.
       
    42         if (WaitForSingleObject(hTimer, INFINITE) != WAIT_OBJECT_0)
       
    43         {
       
    44             printf("WaitForSingleObject failed (%d)\n", GetLastError());
       
    45             break;
       
    46         }
       
    47         timer_notify();
       
    48     }
       
    49 
       
    50     __cleanup();
    50     __cleanup();
    51 
    51 
    52     return 0;
    52     return 0;
    53 }
    53 }