

WaitNext
Details

- The eidi are EvaluationObject expressions obtained by submitting expressions for concurrent evaluation using ParallelSubmit.
- WaitNext[{eid1,eid2,…}] returns a list {res,eid,eids}, where res is the result of the finished evaluation, eid is its EvaluationObject, and eids is the list of remaining evaluations.
- The last element in the list produced by WaitNext is suitable for another call to WaitNext.
Examples
open all close allBasic Examples (1)
Scope (1)
Define a symbol only on the master kernel:
Submit a number of evaluations using this symbol:
Return the next result, but wrap it in Hold first:
Applications (1)
Test for primality, returning $Failed if it is not prime:
Adaptively schedule search jobs until a result has been found or the computation is aborted:
Properties & Relations (2)
ParallelTry is essentially implemented in terms of WaitNext:
Scheduled evaluations no longer needed can be aborted with AbortKernels:
Possible Issues (2)
No more than $KernelCount evaluations are initially run to find the fastest one:
See Also
WaitAll ParallelSubmit ParallelTry EvaluationObject SocketWaitNext
Function Repository: EvaluationObjectState
Related Guides
History
Text
Wolfram Research (2008), WaitNext, Wolfram Language function, https://reference.wolfram.com/language/ref/WaitNext.html.
CMS
Wolfram Language. 2008. "WaitNext." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/WaitNext.html.
APA
Wolfram Language. (2008). WaitNext. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WaitNext.html
BibTeX
@misc{reference.wolfram_2025_waitnext, author="Wolfram Research", title="{WaitNext}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/WaitNext.html}", note=[Accessed: 11-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_waitnext, organization={Wolfram Research}, title={WaitNext}, year={2008}, url={https://reference.wolfram.com/language/ref/WaitNext.html}, note=[Accessed: 11-August-2025]}