RpcSmSetThreadHandle function (rpcndr.h)
The RpcSmSetThreadHandle function sets a thread handle for the stub memory–management environment.
RPC_STATUS RpcSmSetThreadHandle( RPC_SS_THREAD_HANDLE Id );
Thread handle returned by a call to RpcSmGetThreadHandle.
||The call succeeded.|
An application calls RpcSmSetThreadHandle to set a thread handle for the stub memory–management environment. A thread used to manage memory for the stub memory–management environment calls RpcSmGetThreadHandle to obtain a handle for its memory environment. In this way, another thread that calls RpcSmSetThreadHandle by using this handle can then use the same memory-management environment.
The same memory management–thread handle must be used by multiple threads calling RpcSmAllocate and RpcSmFree to manage the same memory. Before spawning new threads to manage the same memory, the thread that established the memory-management environment (parent thread) calls RpcSmGetThreadHandle to obtain a thread handle for this environment. Then, the spawned threads call RpcSmSetThreadHandle with the new manager handle provided by the parent thread.
Note that RpcSmSetThreadHandle is usually called by a thread spawned by a server-manager procedure. The stub sets up the memory-management environment for the manager procedure, and the manager calls RpcSmGetThreadHandle to obtain a thread handle. Then, each spawned thread calls RpcSmGetThreadHandle to get access to the manager's memory-management environment.
A thread can also call RpcSmGetThreadHandle and RpcSmSetThreadHandle to save and restore its memory-management environment.
|Minimum supported client||Windows 2000 Professional [desktop apps | UWP apps]|
|Minimum supported server||Windows 2000 Server [desktop apps | UWP apps]|
|Header||rpcndr.h (include Rpc.h)|