This is not a very neat way to do this, but you can constantly call system calls kill(2)to the specified pid, setting zero as a signal. The first time you killfail, setting errnoto ESRCH, you can conclude that the process has completed.
source
share