RpcCancelThread  M5ZSN3

The RpcCancelThread function cancels a thread.

This function is supported only by Windows NT.

#include <rpc.h>

RPC_STATUS RPC_ENTRY RpcCancelThread(

    HANDLE  ThreadHandle

 

   );

 

 

Parameters

ThreadHandle

Specifies the handle of the thread to cancel.

 

Remarks

The RpcCancelThread routine allows one client thread to cancel an RPC in progress on another client thread. When the routine is called, the server runtime is informed of the cancel operation. The server stub can determine if the call has been cancelled by calling RpcTestCancel. If the call has been cancelled, the server stub should clean up and return control to the client.

By default, the client waits forever for the server to return control after a cancel. To reduce this time, call RpcMgmtSetCancelTimeout, specifying the number of seconds to wait for a response. If the server does not return within this interval, the call fails at the client with an RPC_S_CALL_FAILED exception. The server stub continues to execute.

 

Note  This routine is only supported for Windows NT clients.

 

Return Values

Value

Meaning

RPC_S_OK

Success

RPC_S_ACCESS_DENIED

Thread handle does not have privilege

RPC_S_CANNOT_SUPPORT

Called by an MS-DOS or Windows 3.x client