Re: Check whether a dbus caller is still alive

Lawrence D'Oliveiro <ldo-kC51rjc0cqs1dNLGKZg6taU/[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Organization Geek Central
Message-ID <[email protected]>
On Sun, 1 Oct 2017 14:25:51 +0100, David Llewellyn-Jones wrote:

> 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.

You could get the client pid from the request message, and periodically
check that that process still exists, with kill(pid, 0). The 0 signal
doesn’t actually try to kill the process, only check that you are able
to do so; if you get no error or EPERM, then the process still exists,
but if you get ESRCH, then it is gone.
_______________________________________________
dbus mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dbus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.