hello everyone!
i'm writing a program using linux environment and i'm curious about the use of
waitpid().i have searched the command on google but i'm not sure i understood the return values of the command. for example i want to use it as follows:

if(waitpid(-1,&status,WNOHANG )>0)
sum++;

where sum counts the processes that have finished.
i'm not sure if waitpid returns a positive value when a process is done
thanks in advance

Read this for return values

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.