Ol'a, estou tentando compilar este programa...
 
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/timerfd.h>
static int thread_1_count;
static int thread_2_count;
long start;
int out[1000];
static void *thread_1(void *arg)
{
    start=now();
    printf("Thread 1 period 10ms\n");
        for(int t=0; t <1000; t++){
            out[t] = now() - start;
            start = now();
            delay_ms(1);
            }
    
    return NULL;
}
static void *thread_2(void *arg)
{
    
    printf("Thread 2 period 20ms\n");
    
    while (1) {
        thread_2_count++;
            for(int i=0;i<1000;i++){
                printf("%d", "%d", i, out[i] );
            }
    }
    return NULL;
}
int main(int argc, char *argv[])
{
    pthread_t t_1;
    pthread_t t_2;
    printf("Periodic threads using timerfd\n");
    pthread_create(&t_1, NULL, thread_1, NULL);
    pthread_create(&t_2, NULL, thread_2, NULL);
    sleep(10);
    printf("thread1 %d iterations\n", thread_1_count);
    printf("thread2 %d iterations\n", thread_2_count);
    return 0;
}
	Para fazer um teste no Ubuntu com o RTAI, por'em, ele est'a retornando este erro abaixo:
 
	obs: 'e um trecho de codigo do 2net.com, fiz algumas altera'coes para comparar o tempos.
 
	obs2: ele estava rodando normalmente, mesmo ap'os minhas altera'coes.
 
	 
 
	# cc -Wall -std=gnu99 -g -pthread -lrt -o timerfd timerfd.c -lrt 
	timerfd.c: In function ‘thread_1’: 
	timerfd.c:27:2: warning: implicit declaration of function ‘now’ [-Wimplicit-function-declaration] 
	  start=now(); 
	  ^ 
	timerfd.c:35:4: warning: implicit declaration of function ‘delay_ms’ [-Wimplicit-function-declaration] 
	    delay_ms(1); 
	    ^ 
	timerfd.c: In function ‘thread_2’: 
	timerfd.c:50:5: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘char *’ [-Wformat=] 
	     printf("%d", "%d", i, out );      ^ timerfd.c:50:5: warning: too many arguments for format [-Wformat-extra-args] /tmp/cc7hgWzU.o: na função `thread_1': /home/bessa/src/periodic-threads-master/timerfd.c:27: referência indefinida para `now' /home/bessa/src/periodic-threads-master/timerfd.c:32: referência indefinida para `now' /home/bessa/src/periodic-threads-master/timerfd.c:33: referência indefinida para `now' /home/bessa/src/periodic-threads-master/timerfd.c:35: referência indefinida para `delay_ms' collect2: error: ld returned 1 exit status make: ** [timerfd] Erro 1