Check whether a dbus caller is still alive

Thiago Macieira thiago at kde.org
Sun Oct 1 17:28:37 UTC 2017


On Sunday, 1 October 2017 06:25:51 PDT David Llewellyn-Jones wrote:
> Hi,
> 
> I have an application that connects to a systemd service via the system
> bus. The application makes a synchronous call which blocks, until the
> service responds, which may take some time.
> 
> My concern is that the application may get closed before the service
> responds. Is there any way for the service to check whether the
> invocation is still valid? If the application closes, I'd like the
> service to stop the long-running operation.

Sure. You can watch the NameOwnerChanged signal to see if that particular 
unique connection ID changes owner to "", indicating that it disconnected.

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



More information about the dbus mailing list