equal
deleted
inserted
replaced
2 #include <string.h> |
2 #include <string.h> |
3 #include <time.h> |
3 #include <time.h> |
4 #include <signal.h> |
4 #include <signal.h> |
5 |
5 |
6 |
6 |
7 void timer_notify(sigval_t val) |
7 void PLC_timer_notify(sigval_t val) |
8 { |
8 { |
9 struct timespec CURRENT_TIME; |
9 struct timespec CURRENT_TIME; |
10 clock_gettime(CLOCK_REALTIME, &CURRENT_TIME); |
10 clock_gettime(CLOCK_REALTIME, &CURRENT_TIME); |
11 __run(); |
11 __run(); |
12 } |
12 } |
29 memset (&sigev, 0, sizeof (struct sigevent)); |
29 memset (&sigev, 0, sizeof (struct sigevent)); |
30 memset (&timerValues, 0, sizeof (struct itimerspec)); |
30 memset (&timerValues, 0, sizeof (struct itimerspec)); |
31 sigev.sigev_value.sival_int = 0; |
31 sigev.sigev_value.sival_int = 0; |
32 sigev.sigev_notify = SIGEV_THREAD; |
32 sigev.sigev_notify = SIGEV_THREAD; |
33 sigev.sigev_notify_attributes = NULL; |
33 sigev.sigev_notify_attributes = NULL; |
34 sigev.sigev_notify_function = timer_notify; |
34 sigev.sigev_notify_function = PLC_timer_notify; |
35 timerValues.it_value.tv_sec = tv_sec; |
35 timerValues.it_value.tv_sec = tv_sec; |
36 timerValues.it_value.tv_nsec = tv_nsec; |
36 timerValues.it_value.tv_nsec = tv_nsec; |
37 timerValues.it_interval.tv_sec = tv_sec; |
37 timerValues.it_interval.tv_sec = tv_sec; |
38 timerValues.it_interval.tv_nsec = tv_nsec; |
38 timerValues.it_interval.tv_nsec = tv_nsec; |
39 |
39 |