Cancels an asynchronous process that has not yet completed
Syntax
ESS_FUNC_M EssCancelProcess (hCtx);
Parameter | Data Type | Description |
---|---|---|
hCtx | ESS_HCTX_T | API context handle. |
Notes
If you use this function to cancel a process, the database may be left in an inconsistent state, with only some of the data recalculated.
Calling this function except after initiating a successful asynchronous database operation (e.g. a calculation) will generate an error.
Return Value
None.
Access
This function requires no special privilege.
Example
ESS_VOID_T ESS_CancelProcess(ESS_HCTX_T hCtx) { ESS_FUNC_M sts = ESS_STS_NOERR; ESS_STR_T Script; ESS_PROCSTATE_T pState; ESS_USHORT_T Count; Script = "CALC ALL;"; sts = EssBeginCalc (hCtx,ESS_TRUE); if (!sts) sts = EssSendString (hCtx, Script); if (!sts) sts = EssEndCalc (hCtx); /************************************* Check process state and cancel it if it takes too long *************************************/ if (!sts) { sts = EssGetProcessState (hCtx, &pState); while(!sts && (pState.State != ESS_STATE_DONE)) { Count = Count + 1; if (Count == 1000) sts = EssCancelProcess(hCtx); sts = EssGetProcessState (hCtx, &pState); } } }
See Also