Linux 信号带有额外的信息参数
我想在 sa_sigaction 处理程序的回调中获得一些额外的信息,但这似乎不可能。
所以我想知道你是否可以建议我替代方案。基本要求:
- 函数 A 引发一个信号/事件,其中包含指向处理该事件的 struct
- Handler 函数的指针。
- 处理函数只会在事件发生时调用,并且等待事件的循环(如 select() 中)是不可取的。
I was to have some extra information in the callback to sa_sigaction handler, it does not seems possible.
So I was wondering if you could suggest me alternatives. Basic requirements:
- Function A raises an signal/event with a pointer to a struct
- Handler function tackles the event.
- The handler function would only be called on an event and a loop to wait for the event, as in select() , is undesirable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
像这样 ?
另一端:
警告!:通过引用传递可能无法在不同的地址/进程空间之间工作(我自己还没有测试过),所以首先在同一进程的线程之间测试这个......
祝你好运:-)
like this ?
and on the other end:
Warning!: passing by reference might not work between different address/process spaces (I haven't tested this myself yet) so first test this between threads of the same process....
good luck :-)