Please help with signals, some seem to get lost
Thiago Macieira
thiago at kde.org
Tue Jan 14 00:38:31 UTC 2025
On Monday 13 January 2025 05:14:40 Pacific Standard Time Erik Slagter wrote:
> Hi there,
>
> I'll start with a terse description of what I am facing, maybe that is
> enough for you guys to point me in the right direction. If not, I'll
> elaborate.
>
> For my application I need to send signals to several listeners on the
> system bus. The signals are composed of a string of about 300 bytes.
> Sometimes some signals are sent in quick succession and that's where it
> goes wrong.
Are they directed signals? That is, do they have a destination bus address
set?
> I use this code (I'd like to keep things very simple, no main loops etc,
> the handler runs in it's own thread anyway):
>
> dbus_connection_read_write_dispatch(connection, -1) // blocks until a
> message is received, quit if negative result
> message = dbus_connection_pop_message(connection)
>
> Now every now and then dbus_connection_read_write_dispatch returns from
> blocking but dbus_connection_pop_messages returns NULL.
That's normal. It dispatches one read OR write. If it did the latter, then
there is no message to be popped.
> Two interesting observations here:
> - other processes that are listening to the same signal do get the
> message indeed, it's just one (random) of them that gets the NULL message
It probably was sending something before that. Call it again, because after
all this function is meant to be used in a loop, as its documentation shows:
https://dbus.freedesktop.org/doc/api/html/
group__DBusConnection.html#ga580d8766c23fe5f49418bc7d87b67dc6
> - if I apply rate limiting, the problem decreases and at a rate of 2
> signals per second it's gone.
>
> So it looks like I am hitting a rate limiter somewhere. I really want to
> go full throttle here, is there a way to change this parameter? Is there
> another workaround for this?
There isn't a rate limiter.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Principal Engineer - Intel DCAI Platform & System Engineering
More information about the dbus
mailing list