Singular Manual: waitall

  | ### 5.1.167 waitall `Syntax:` `waitall (` list_expression `)` `waitall (` list_expression `,` int_expression `)` `Type:` int `Purpose:` Expects a list of open links (of mode ssi:fork, ssi:tcp) and waits until all of them are finished, i.e., are ready to be read. In the first case, the command waits for all links to finish (or to crash, see below) and may therefore run forever. In the second case, a timeout in milliseconds can be provided, forcing the command to terminate after the specified time. If the given timeout is 0, the command checks whether all links are finished or not, but does not wait for any link (polling). Return values are: -1: The read state of all links is `"eof"`, see link, status. This might happen if all the links crashed. 0: timeout (or polling): None of the links is ready. 1: All links are ready. (Note: There might be links whose read state is `"eof"`, but at least one link is ready.) `Example:`
        link l1 = "ssi:fork"; open(l1);
        link l2 = "ssi:fork"; open(l2);
        link l3 = "ssi:fork"; open(l3);
        list l = list(l1,l2,l3);
        write(l1, quote(system("sh", "sleep 15")));
        write(l2, quote(system("sh", "sleep 10")));
        write(l3, quote(system("sh", "sleep 11")));
        waitall(l, 5000); // terminates after 5sec with result 0
      ==> 0
        waitall(l);       // terminates after 10 more sec
      ==> 1
        close(l1);
        close(l2);
        close(l3);
See waitfirst.

User manual for Singular version 4.3.0p1, 2022, generated by texi2html.