CPXXsetterminate and CPXsetterminate

This routine enables applications to terminate CPLEX gracefully.

int  CPXXsetterminate( CPXENVptr env, volatile int * terminate_p )

int  CPXsetterminate( CPXENVptr env, volatile int * terminate_p )

Description

This routine enables applications to terminate CPLEX gracefully.

Conventionally, your application should first call this routine to set a pointer to the termination signal. Then the application can set the termination signal to a nonzero value to tell CPLEX to abort. These conventions will terminate CPLEX even in a different thread. In other words, this routine makes it possible to handle signals such as control-C from a user interface. These conventions also enable termination within CPLEX callbacks.

Arguments

env
The pointer to the CPLEX environment, as returned by CPXXopenCPLEX/CPXopenCPLEX.
terminate_p
A pointer to the termination signal.

Return

The routine returns 0 (zero) if successful and nonzero if an error occurs.

Example


status = CPXsetterminate (env, &terminate);

To unset a termination signal set by this routine, call this routine again later with a NULL pointer as the value of the argument terminate_p.