WSGetYieldFunction (C Function)
WSYieldFunctionObject WSGetYieldFunction(WSLINK link)
returns the currently installed yield function for the link referenced by link.
- Some WSTP 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 WSTP will automatically make calls to the yield function while it blocks.
- If link does not have a yield function installed, WSGetYieldFunction() returns (WSYieldFunctionObject)0.
- WSGetYieldFunction() is declared in the WSTP header file wstp.h.
Basic Examples (1)
int AppYieldFunction1 (WSLINK mlp, WSYieldParameters yp)
/* ... */
int AppYieldFunction2 (WSLINK mlp, WSYieldParameters yp)
/* ... */
/* check which yield function is installed in a link */
int f(WSLINK lp)
yf = WSGetYieldFunction(lp);
if(yf == (WSYieldFunctionObject)AppYieldFunction1) return 1;
else if(yf == (WSYieldFunctionObject)AppYieldFunction2) return 2;
else if(yf == (WSYieldFunctionObject)0) return 0;