Home Online Manual
Back: parallel_lib
Forward: parallelWaitFirst
Up: parallel_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

D.2.7.1 parallelWaitN

Procedure from library parallel.lib (see parallel_lib).

parallelWaitN(commands, arguments, N[, timeout]); commands list, arguments list, N int, timeout int

a list, containing the results of commands[i] applied to arguments[i], i = 1, ..., size(arguments).
The procedure waits for N jobs to finish.
An optional timeout in ms can be provided. Default is 0 which disables the timeout.

The entries of the list commands must be strings. The entries of the list arguments must be lists.
The type of any entry of the returned list whose corresponding task did not finish (due to timeout or error) is "none".
The returned list may contain more than N results if several jobs finished "at the same time". It may contain less than N results in the case of timeout or errors occurring.

LIB "parallel.lib";
ring R = 0, (x,y,z), lp;
ideal I = 3x3y+x3+xy3+y2z2, 2x3z-xy-xz3-y4-z2, 2x2yz-2xy2+xz2-y4;
ideal J = x10+x9y2, x2y7-y8;
list commands = list("std", "std");
list arguments = list(list(I), list(J));
parallelWaitN(commands, arguments, 1);
==> [2]:
==>    _[1]=y15-y12
==>    _[2]=xy12+y14
==>    _[3]=x2y7-y8
==>    _[4]=x10+x9y2
See also: parallelWaitAll; parallelWaitFirst; tasks_lib.