Qt-interest Archive, March 2008
Determine if a PID is an active process
Message 1 in thread
Hi all,
is there some platform-independent way to determine if a process for a
given PID is running?
e.g. I have a server that writes its PID into a file and some other
program needs to be able to check if the process is still alive.
I would appreciate doing this in a platform independent manner (at least
I need it for Linux and Windows)
Any idea?
\Ralf
--
[ signature omitted ]
Message 2 in thread
Ralf Neubersch wrote:
> Hi all,
>
> is there some platform-independent way to determine if a process for a
> given PID is running?
> e.g. I have a server that writes its PID into a file and some other
> program needs to be able to check if the process is still alive.
>
> I would appreciate doing this in a platform independent manner (at least
> I need it for Linux and Windows)
>
> Any idea?
if you need very rough check of process existence use
kill(PID,0) under UNIX and OpenProcess under Win32
but it has different semantics and both are week.
If you need solid result it's better to use sockets for
both server and client.
--
[ signature omitted ]