Why timer_create throw error for SIGEV_THREAD in solaris 10?

拥有回忆 提交于 2019-12-02 08:50:19

问题


I wrote a piece of by using timer_create for sets the timer to invoke a thread in which i set sigev_notify as SIGEV_THREAD, it is giving me error EINVAL(Invalid argument) but when i am setting sigev_notify as SIGEV_SIGNAL code is working fine.

my this piece of code is working in all OS even in solaris 11 but for solaris 10 giving me error.

code given below:

{
int status =0;
struct itimerspec ts;
struct sigevent se;

se.sigev_notify = SIGEV_THREAD;
se.sigev_value.sival_int = val;
se.sigev_notify_function = func;
se.sigev_notify_attributes = NULL;

status = timer_create(CLOCK_REALTIME, &se, timer_id);

ts.it_value.tv_sec = abs(delay);
ts.it_value.tv_nsec = (delay-abs(delay)) * 1e09;
ts.it_interval.tv_sec = abs(interval);
ts.it_interval.tv_nsec = (interval-abs(interval)) * 1e09;

status = timer_settime(*timer_id, 0, &ts, 0);

}

Please help me to solve this issue.

Thanks in advance...


回答1:


As per this man-page Solaris 10 does not know SIGEV_THREAD, but only

The sigev_notify member specifies the notification mechanism to use when an asynchronous event occurs. The sigev_notify member may be defined with the following values:

SIGEV_NONE

No asynchronous notification is delivered when the event of interest occurs.

SIGEV_SIGNAL

A queued signal, with its value application-defined, is generated when the event of interest occurs.

SIGEV_PORT

An asynchronous notification is delivered to an event port when the event of interest occurs. The sival_ptr member points to a port_notify_t structure (see port_associate(3C)). The event port identifier as well as an application-defined cookie are part of the port_notify_t structure



来源:https://stackoverflow.com/questions/47989417/why-timer-create-throw-error-for-sigev-thread-in-solaris-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!