OBSOLETE WSTP C FUNCTION

MLGetYieldFunction()
This feature is not supported on the Wolfram Cloud.

has been replaced by WSGetYieldFunction.

MLYieldFunctionObject MLGetYieldFunction(MLINK link)
returns the currently installed yield function for the link referenced by link.

DetailsDetails

  • 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.
  • If link does not have a yield function installed, MLGetYieldFunction() returns (MLYieldFunctionObject)0.
  • MLGetYieldFunction() is declared in the MathLink header file mathlink.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#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;    
}