OpenersNotesSection(Spacer1)Details

MLReadyParallel() returns the index into the list of link objects of the link that has data to read. The links are indexed from 0 to (n-1).

MLReadyParallel() returns MLREADYPARALLELTIMEDOUT if no link has data to read after the timeout period expires.

MLReadyParallel() returns MLREADYPARALLELERROR in the event of an error.

To wait for an indefinite period until a link is ready, set waittime to MLINFINITEWAIT.

MLReadyParallel() cannot be used as a fine-grained wait mechanism.

MLReadyParallel() is analogous to the kernel function (RefLink[LinkReadyQ, paclet:ref/LinkReadyQ])[{},waittime].

MLReadyParallel() is declared in the MathLink header file (RefLink[mathlink.h, paclet:ref/file/mathlink.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "mathlink.h"

/* read data from either of two links */

void f(MLENV env, MLINK lp1, MLINK lp2)
{
	mltimeval timeout;
	MLINK links[2];
	int result;

	timeout.tv_sec = 5;
	timeout.tv_usec = 0;

	links[0] = lp1;
	links[1] = lp2;

	result = MLReadyParallel(env, (MLINK *)links, 2, timeout);
	if(result == MLREADYPARALLELERROR)
		{ /* unable to check links for data */ }
	else if(result != MLREADYPARALLELTIMEDOUT)
		{
			/* read the link that has data ready */
			if(result == 0)
				/* read lp1 */
			else
				/* read lp2 */
		}
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLReady(), paclet:ref/c/MLReady])}})}})