Linux/Unix System Programming-wait method waiting for the completion of a sub-process

Source: Internet
Author: User
Linux/Unix System Programming-wait method waiting for the completion of a sub-process-general Linux technology-Linux programming and kernel information. The following is a detailed description. If we have many sub-processes, wait will return when any sub-process ends. If we wait for a specific process to end (assuming that we know the process ID), we can call the wait function on the old Unix system, and compare the process ID returned by it with the process ID we want. If the process ended is not the process we expected, we have to save the process ID and end state, and then call the wait function again. We need to continue to do this until the process we expect ends. The next time we want to wait for a specific process, we need to use the list of completed processes (that is why we need to record the process ID and end state) determine if we have waited for this process. If we do not have to call the wait function again.

In some popular Unix systems, we can use waitpid to do this, which is more convenient.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.