Originally posted by: SystemAdmin
Hello,
I've surfed and have found various examples on creating POSIX timers using timer_create(), but for some reason am having lots of trouble with this on the AIX 5.1 platform. The AIX platform for some reason doesn't recognize the SIGEV_THREAD keyword, although just about every example of POSIX timer implementation includes the use of this keyword.
Here is the code that I'm implementing thus far, which is similar to what is being implemented on other platforms.
#include <stdlib.h>
#include <sys/time.h>
#include <sys/signal.h>
#include <semaphore.h>
#include <sys/errno.h>
#include <pthread.h>
void callback(union sigval sigev_value) { printf("In callback()\n"); }
void main()
{
int rc;
timer_t timer_id;
struct sigevent evp;
int errno = 0;
evp.sigev_notify = SIGEV_THREAD;
evp.sigev_notify_function = callback;
evp.sigev_notify_attributes = NULL;
evp.sigev_value.sival_ptr = &timer_id;
/** if (rc = timer_create(CLOCK_REALTIME, NULL &evp, &timer_id)) { **/
if (rc = timer_create(CLOCK_REALTIME, &evp, &timer_id)) {
}
printf("timer_create() Rtn rc %d error %d\n", rc, errno);
perror("");
exit(rc);
}
And when I compile (cc timer.c -o timer), I get the following error:
"timer.c", line 19.24: 1506-045 (S) Undeclared Identifier SIGEV_THREAD.
Any idea what I need to include to get this to compile on AIX 5.1? Or, perhaps,
it is not included in any of the files in the /usr/include dir on AIX 5.1?
Any help or info. would be great.
Thanks,
dedham_ma_man
#AIX-Forum