DBusWatch function, DBusTimeout functions Why these functions is needed ?

Thiago Macieira thiago at kde.org
Mon Dec 26 11:37:11 UTC 2016


Em sábado, 24 de dezembro de 2016, às 20:02:05 BRST, Денис Котов escreveu:
> Hi All,
> 
> Currently I have faced with understanding of watch and timeout functions in
> libdbus.
> I do not quit understand why they are needed.

Well, they are needed to let libdbus know when one of its file descriptors has 
activity or is ready for activity, or when a timer expires.

> From description I understand they are needed to check state of socket. If
> something changes then from libdbus I will receive this message and I have
> either to read something or to write something to socket.

The other way around. They are used to tell libdbus that the socket has 
activity so it will read, or that the socket is ready for writing so it will 
write.

> It means that I should not create infinite while loop, but register
> callbacks and when will be possibility I will write to out-queue or read to
> in-queue, am I right ?

Your infinite loop has in its centre a call to select() or poll().

> 
> And maybe some brief explanation what is DBusTimeout function ?


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



More information about the dbus mailing list