Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > MathLink C Language Functions >
MathLink C Function

MLGetYieldFunction()

MLYieldFunctionObject MLGetYieldFunction(MLINK link)
returns the currently installed yield function for the link referenced by link.
  • Some MathLink API calls will block until data is available to read or space is available for writing. If an application needs to perform other useful processing during that blocking time, the application can install a yield function for the link and MathLink will automatically make calls to the yield function while it blocks.
  • MLGetYieldFunction() is declared in the MathLink header file mathlink.h.
#include "mathlink.h"

int AppYieldFunction1 (MLINK mlp, MLYieldParameters yp)
{
    /* ... */
    return 0;
}

int AppYieldFunction2 (MLINK mlp, MLYieldParameters yp)
{
    /* ... */
    return 0;
}


/* check which yield function is installed in a link */

int f(MLINK lp)
{
    MLYieldFunctionObject yf;

    yf = MLGetYieldFunction(lp);
    if(yf (MLYieldFunctionObject)AppYieldFunction1) return 1;
    else if(yf (MLYieldFunctionObject)AppYieldFunction2) return 2;
    else if(yf (MLYieldFunctionObject)0) return 0;

    return -1;    
}
© 2013 Wolfram Research, Inc. Japanese
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team