Skip to content

100% CPU usage during wait #7

Description

@raypulver

I have found waitpid very useful for my project but have recently discovered that it uses the entire CPU while it waits. Is there any change that could be made to the code so that it blocks execution without consuming resources during the wait? The problem is with this loop

do {
  r = waitpid(child, &status, WNOHANG);
} while (r != -1);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions