Skip to content

Latest commit

 

History

History
143 lines (112 loc) · 4.37 KB

nf-rpcdce-rpccancelthread.md

File metadata and controls

143 lines (112 loc) · 4.37 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:rpcdce.RpcCancelThread
RpcCancelThread function (rpcdce.h)
The RpcCancelThread function cancels a thread. The RpcCancelThread function should not be used to cancel asynchronous RPC calls; instead, use the RpcAsyncCancelCall function to cancel an asynchronous RPC call.
RpcCancelThread
RpcCancelThread function [RPC]
_rpc_rpccancelthread
rpc.rpccancelthread
rpcdce/RpcCancelThread
rpc\rpccancelthread.htm
Rpc
4315562e-674b-40a4-a2d9-133e6ab27c25
12/05/2018
RpcCancelThread, RpcCancelThread function [RPC], _rpc_rpccancelthread, rpc.rpccancelthread, rpcdce/RpcCancelThread
rpcdce.h
Rpc.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
Rpcrt4.lib
Rpcrt4.dll
Windows
19H1
RpcCancelThread
rpcdce/RpcCancelThread
c++
APIRef
kbSyntax
DllExport
Rpcrt4.dll
RpcCancelThread

RpcCancelThread function

-description

The RpcCancelThread function cancels a thread. The RpcCancelThread function should not be used to cancel asynchronous RPC calls; instead, use the RpcAsyncCancelCall function to cancel an asynchronous RPC call.

-parameters

-param Thread

Handle of the thread to cancel.

-returns

Value Meaning
RPC_S_OK
The call succeeded.
RPC_S_ACCESS_DENIED
Thread handle does not have privilege. Thread handles must have THREAD_SET_CONTEXT set properly for the function to execute properly.
RPC_S_CANNOT_SUPPORT
Called by an MS-DOS or Windows 3.x client.
 
Note  For a list of valid error codes, see RPC Return Values.
 

-remarks

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

The RpcCancelThread function cannot be used to cancel a call that has issued a static callback. Do not cancel remote procedure calls that may call a function declared with the [callback] attribute in the IDL-file.

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 run.

If you are using the named pipes protocol, ncacn_np, you must specify a finite time-out.

You can use RpcCancelThread with any of the connection-oriented protocols (ncacn_*) and with any of the datagram protocols except ncadg_mq and ncalrpc.

Note  Windows XP/2000 The RpcCancelThread function is not available for ncacn_http. The RpcCancelThread function supports ncacn_http on Windows Server 2003 or later operating systems and Windows XP with Service Pack 1 (SP1) and later.

-see-also

RpcTestCancel

ncacn_http

ncadg_mq

ncalrpc