如何在Python中发送和接收实时信号`sigqueue()`? [英] How do I send and receive real-time signals `sigqueue()` in Python?

查看:357
本文介绍了如何在Python中发送和接收实时信号`sigqueue()`?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Python提供了一个signals模块和os.kill;它具有用于sigqueue()(带有附加数据的实时信号)的功能吗?有哪些替代方案?

Python provides a signals module and os.kill; does it have a facility for sigqueue() (real-time signals with attached data)? What are the alternatives?

推荐答案

您可以使用 ctypes

>>> from ctypes import *
>>> c = cdll.LoadLibrary("libc.so.6")
>>> c.sigqueue
<_FuncPtr object at 0xb7dbd77c>
>>> c.sigqueue(100, 10, 0)
-1
>>>

您将必须查找如何用我从未做过的ctypes进行联合,但我认为这是可能的.

You'll have to look up how to make a union in ctypes which I've never done before but I think is possible.

这篇关于如何在Python中发送和接收实时信号`sigqueue()`?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆