Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: ‘struct sigevent’ has no member named ‘sigev_notify_thread_id’

The following "toy" code represents a problem I am having in a larger code base using POSIX timers.

#include <time.h>
#include <errno.h>
#include <signal.h>
#include <iostream>

using namespace std;

int main()
{   
    struct sigevent sevp;
    long threadId = 5;

    sevp.sigev_notify = SIGEV_THREAD_ID;
    sevp.sigev_notify_thread_id = threadId;

    return 0;
}

When I try to compile it using g++ on a Linux machine I get the error:

error: ‘struct sigevent’ has no member named ‘sigev_notify_thread_id’

Is there a reason why? This leads me to believe that the sigevent struct has a member called sigev_notify_thread_id.

like image 591
dinkelk Avatar asked May 30 '13 02:05

dinkelk


1 Answers

Changing sevp.sigev_notify_thread_id to sevp._sigev_un._tid fixed my problem. You can see the definition on line 295 here.

Thanks to @Duck for the helpful comment.

like image 184
dinkelk Avatar answered Oct 15 '22 23:10

dinkelk