#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 */
}
}