DBusWatch function, DBusTimeout functions Why these functions is needed ?

Thiago Macieira thiago at kde.org
Tue Dec 27 11:34:08 UTC 2016


Em terça-feira, 27 de dezembro de 2016, às 10:40:49 BRST, Денис Котов 
escreveu:
> Okay, you mean DBus uses user's callbacks like a platform specific API for
> creating a platform specific timer (QTimer, linux timer and etc.) and DBus
> deals only with abstract number that in fact is timeout in milliseconds.

Right. The QtDBus binding handles a DBusTimeout add_timeout callback by 
creating a QTimer (actually, QObject::startTimer). When that expires, it calls 
the handler function to let libdbus know that the time has passed.

> In this case I need only create Timer, check when this timer expired and
> then make dbus_timeout_handle() to say DBus that Timer has expired, am I
> right ?

Right.

> And should I restart timer after it expired and start again or I should
> remove this timer from list ?

QtDBus doesn't remove them. The timers could continue.

But I don't know of any operation in D-Bus that would require repeating 
timers. The handler funciton will call the remove_timeout callback to remove 
it soon after.

> But in this case when DBus request to add watcher for me it seems like
> workaround, because with DBus know how to work with this platform specific
> file descriptor, but anyway it asks us to say when it will be handled (for
> me it seems strange).

It can't know. That's simply not possible. How could libdbus add the file 
descriptor to Qt's file descriptor watching list, for example?

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center



More information about the dbus mailing list