OpenersNotesSection(Spacer1)Details

WSReadyParallel() 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).

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

WSReadyParallel() returns WSREADYPARALLELERROR in the event of an error.

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

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

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

WSReadyParallel() is declared in the WSTP header file (RefLink[wstp.h, paclet:ref/file/wstp.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "wstp.h"

/* read data from either of two links */

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

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

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

	result = WSReadyParallel(env, (WSLINK *)links, 2, timeout);
	if(result == WSREADYPARALLELERROR)
		{ /* unable to check links for data */ }
	else if(result != WSREADYPARALLELTIMEDOUT)
		{
			/* read the link that has data ready */
			if(result == 0)
				/* read lp1 */
			else
				/* read lp2 */
		}
}

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

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[WSTP C API Developer Guide (Mac OS X), paclet:tutorial/WSTPDeveloperGuide-MacintoshOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Unix and Linux), paclet:tutorial/WSTPDeveloperGuide-UnixOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Windows), paclet:tutorial/WSTPDeveloperGuide-WindowsOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Alphabetical Listing of WSTP C Functions, paclet:guide/AlphabeticalListingOfWSTPCFunctions])}, {▪(RefLinkPlain[Low-Level WSTP Operations, paclet:guide/LowLevelWSTPOperations])}})}})