struct sigevent timerEvent;
memset(&timerEvent, 0, sizeof(timerEvent));
timerEvent.sigev_value.sival_int = 0;
timerEvent.sigev_value.sival_ptr = diaBase;
timerEvent.sigev_notify = SIGEV_THREAD;
timerEvent._sigev_un._sigev_thread._function = function;
timerEvent._sigev_un._sigev_thread._attribute = NULL;
timer_t timer_ID;
int retVal;
if((retVal = timer_create (CLOCK_REALTIME, &timerEvent, &timer_ID )) != -1)
{
printf("Timer Created Successfully: %ld\n", timer_ID );
}
else
{
printf("Error Creating Timer\n");
}
内存泄漏,以下表示
Syscall param timer_create(evp) points to uninitialised byte(s)
==27384== at 0x530595: timer_create (in /lib/librt-2.5.so)
最佳答案
这似乎是已知的valgrind问题:
http://bugs.kde.org/show_bug.cgi?id=124478
...和...
http://www.google.co.uk/search?source=ig&hl=en&rlz=&q=Syscall+param+timer_create%28evp%29+points+to+uninitialised+byte%28s%29&btnG=Google+Search