POSIX timer_create with SIGEV_THREAD
807567Apr 23 2003 — edited May 13 2003I'm having trouble to get the timers working. Compiling is no problem, but I get a runtime error when I run the code (Code=22, Invalid argument).
Here is the code for creating the timer:
void timeoutHandler(union sigval arg)
{
// do something with arg.sival_ptr which should point to a function
}
void createTimer()
{
struct se sigevent;
se.sigev_notify = SIGEV_THREAD;
se.sigev_signo = SIGRTMIN;
se.sigev_value.sival_ptr = a_function_ptr; // pointer to function that should be passed to the thread routine (timeoutHandler)
se.sigev_notify_function = timeoutHandler;
timer_create(CLOCK_REALTIME, &se, &handle);
}
Does anyone know how to make this work?
I'm running on a Sparc station, Solaris 8, gcc-2.95.3.
Regards
sten.wallin@tietoenator.com