2010-11-29 07:08:30 Posix Timer using Thread - timer_create
Jeremie RAFIN (FRANCE)
I am trying to create a posix timer with a "pthread callback". Something like that (so far I am blocking on creation, so I just give you this part):
static void TimerCallBack(union sigval sigev_value)
struct sigevent SignalEventManagement;
/* Set signal event management */
SignalEventManagement.sigev_notify = SIGEV_THREAD; /* Notification method: POSIX THREAD */
SignalEventManagement.sigev_value.sival_ptr = &TimerId; /* Value passed to thread function: timer handler */
SignalEventManagement.sigev_notify_function = TimerCallBack; /* Function used for notifications */
/* Create a kernel timer */
if (timer_create(/* ClockId */ CLOCK_REALTIME,
/* SigEvent */ &SignalEventManagement,
/* TimerId */ &TimerId) != 0)
printf("Error %d\n", errno);
My problem is that I get error, with errno set to zero. [BTW, please note that this is not "posix" since errno should be set.]
After investigating the implementation of the timer_create in the toolchain, it appears that SIGEV_THREAD is not supported.
Is there any needed patch for toolchain to have posix timer fully implemented (I have 2009R1 one)?
Any other way to have posix timer?
Thanks for you help!