dinkelk dinkelk - 1 year ago 181
C++ Question

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
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
struct has a member called

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download