我想使用 dbus 向同一系列应用程序的其他实例发出信号。似乎要发出信号,我必须执行 a g_bus_own_name
,在获取名称时发出信号,然后g_bus_unown_name
. 这似乎只是为了发送信号。获取名称后,应用程序的另一个实例将挂起,等待该实例“不拥有”该名称。
dbus_message_new_signal
/的弃用方式dbus_connection_send
更加直接。
有没有更简单的方法来发送信号(不拥有名称)。
Yes, as Michael K says, use g_dbus_connection_emit_signal()
. You only have to own a well-known name if you want other users of the bus to be able to address your application by that well-known name, rather than a unique name which changes every time you connect to the bus.