Antonio Fortuny wrote:
Hi guys.

Thanks to all anyway for answering.
I've found two nice solutions to solve my problem.
To be honest I've to mention that what my function receives a paramater which is a PID and the function has to check if that process is still running returning a value. Sorry for any misunderstanding. I agree that my question was ambigous from that point of view.

This is also a fairly common requirement when a program leaves lock files in a directory or a unix-domain socket etc. in /tmp or ~

# ls -l /var/run/*ttyS*
-rw-r--r--  1 root   root  4 Sep  6 13:46  /var/run/mgetty.pid.ttyS11
-rw-r--r--  1 root   root  6 Sep  8 18:46  /var/run/mgetty.pid.ttyS6

2. use kill with signal 0
uses BaseUnix;

  if FpKill(wPID, 0) = 0 then
    MessageDlg('OK', 'FpPid process is running', mtInformation, [mbOK], 0)
  else
    MessageDlg('OK', 'FpPid process is NOT running', mtError, [mbOK], 0);

I guess that solution 2 is the best as it asks immediately the kernel.

I agree.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to