13 #define USECS_PER_SEC 1000000
21 return nanosleep(&ts, NULL);
34 return_value = clock_gettime(CLOCK_MONOTONIC, &ts);
35 tv->tv_sec = ts.tv_sec;
36 tv->tv_usec = ts.tv_nsec / 1000;
42 struct timeval current_time;
46 return_value.sec = current_time.tv_sec;
47 return_value.usec = current_time.tv_usec;
65 struct timeval start_time;
66 struct timeval timeout;
67 struct timeval stop_time;
72 timeradd(&start_time, &timeout, &stop_time);
74 self->stop_time.sec = stop_time.tv_sec;
75 self->stop_time.usec = stop_time.tv_usec;
80 struct timeval current_time;
81 struct timeval stop_time;
82 int is_not_yet_expired;
85 stop_time.tv_sec =
self->stop_time.sec;
86 stop_time.tv_usec =
self->stop_time.usec;
87 is_not_yet_expired =
timercmp(¤t_time, &stop_time, <);
89 return is_not_yet_expired ==
FALSE;
109 pthread_attr_init(&attr);
110 pthread_attr_setstacksize(&attr, stacksize);
111 ret = pthread_create(threadp, &attr, func, param);
123 struct sched_param schparam;
127 pthread_attr_init(&attr);
128 pthread_attr_setstacksize(&attr, stacksize);
129 ret = pthread_create(threadp, &attr, func, param);
130 pthread_attr_destroy(&attr);
135 memset(&schparam, 0,
sizeof(schparam));
136 schparam.sched_priority = 40;
137 ret = pthread_setschedparam(*threadp, SCHED_FIFO, &schparam);