Je viens de trouver la solution dans siginfo.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| typedef struct sigevent
{
sigval_t sigev_value;
int sigev_signo;
int sigev_notify;
union
{
int _pad[__SIGEV_PAD_SIZE];
/* When SIGEV_SIGNAL and SIGEV_THREAD_ID set, LWP ID of the
thread to receive the signal. */
__pid_t _tid;
struct
{
void (*_function) (sigval_t); /* Function to start. */
void *_attribute; /* Really pthread_attr_t. */
} _sigev_thread;
} _sigev_un;
} sigevent_t; |
Maintenant j'utilise ça
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| ptu_event.sigev_notify=SIGEV_THREAD_ID;
ptu_event._sigev_un._tid = pthread_self();
ptu_event.sigev_signo=SIGRTMIN;
PTU_ns=PTU*1000;
ptu_period.it_value.tv_sec=PTU_ns/1000000000;
ptu_period.it_value.tv_nsec=PTU_ns%1000000000;
ptu_period.it_interval=ptu_period.it_value;
if(timer_create(CLOCK_REALTIME,&ptu_event,&ptu_timer)!=0)
{
perror("timer_create");
exit(EXIT_FAILURE);
}
if(timer_settime(ptu_timer,0,&ptu_period,NULL)!=0)
{
perror("timer_settime");
exit(EXIT_FAILURE);
} |
Mais j'ai un autre probleme !!! la compilation se passe bien mais a l'execution
timer_create: Invalid argument
Partager