|
SOLUTIONS
|
MATHEMATICA MATHLINK C 函数
MLReadyParallel()
更多信息更多信息
- MLReadyParallel() 把索引返回到有数据可读的链接中的链接对象列表. 链接的索引从
到
. - 如果在超时期满后没有链接有可读取的数据,MLReadyParallel() 返回 MLREADYPARALLELTIMEDOUT.
- 在错误事件中 MLReadyParallel() 返回 MLREADYPARALLELERROR.
- 若要等待一个不定周期直到链接可用,则将 waittime 设为 MLINFINITEWAIT.
- MLReadyParallel() 不能用作精细的等待机制.
- MLReadyParallel() 类似于内核函数 LinkReadyQ[{}, waittime].
- MLReadyParallel() 在 MathLink 标头文件 mathlink.h 中被声明.
范例范例打开所有单元关闭所有单元
基本范例 (1)基本范例 (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 */
}
}
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
