为什么在solaris 10 中为SIGEV

编程入门 行业动态 更新时间:2024-10-25 20:19:46
本文介绍了为什么在solaris 10 中为SIGEV_THREAD 抛出timer_create 错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我通过使用 timer_create 编写了一段代码来设置计时器以调用我将 sigev_notify 设置为 SIGEV_THREAD 的线程,它给了我错误 EINVAL(无效参数)但是当我将 sigev_notify 设置为 SIGEV_SIGNAL 时,代码工作正常.

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.

我的这段代码适用于所有操作系统,即使是在 solaris 11 中,但对于solaris 10 却给我错误.

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

代码如下:

{
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);

}

请帮我解决这个问题.

提前致谢...

推荐答案

根据 本手册页 Solaris 10 不知道 SIGEV_THREAD,但只知道

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

sigev_notify 成员指定发生异步事件时要使用的通知机制.可以使用以下值定义 sigev_notify 成员:

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

当感兴趣的事件发生时,异步通知被传送到事件端口.sival_ptr 成员指向 port_notify_t 结构(请参阅 port_associate(3C)).事件端口标识符以及应用程序定义的 cookie 是 port_notify_t 结构

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

这篇关于为什么在solaris 10 中为SIGEV_THREAD 抛出timer_create 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 11:32:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1393533.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中为   solaris   SIGEV

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!