srv_terminatethread

Disconnects and exits the client thread associated with the SRV_PROC structure.

Syntax

srv_terminatethread ( SRV_PROC * srvproc );

where

srvproc
Is a pointer to the Open Data Services thread to terminate. The structure parameter contains the information that the Open Data Services Library uses to manage communication and data between the application and the client.

Returns

SUCCEED or FAIL.

Remarks

By passing in the srvproc pointer that refers to a thread, this function can be used to kill any thread that is executing a user request from anywhere in your Open Data Services server application. To use srv_terminatethread to kill a thread other than the one that is executing the current client request, your application must provide a way of tracking active threads and of referring to them using the srvproc pointer. For example, if your application implements its own monitoring thread to determine the status of an active thread, the monitoring thread can use srv_terminatethread to terminate that thread.

The srv_terminatethread function does not terminate the thread immediately. When you issue the srv_terminatethread function, it sets an appropriate status in the SRV_PROC structure that instructs the client to clean up and exit. Open Data Services checks the SRV_PROC structure for termination status at common entry points and, if present, activates exit processing. If the client thread is currently processing an event, it will continue processing and wait until the event handler issues a return before exiting.