RpcSsGetThreadHandle  19UCT8

The RpcSsGetThreadHandle function returns a thread handle for the stub memory management environment.

#include <rpc.h>

RPC_SS_THREAD_HANDLE RPC_ENTRY RpcSsGetThreadHandle (VOID);

Remarks

The RpcSsGetThreadHandle routine is called by applications to obtain a thread handle for the stub memory management environment. A thread used to manage memory for the stub memory management environment uses RpcSsGetThreadHandle to receive a handle for its memory environment. In this way, another thread that calls RpcSsSetThreadHandle by using this handle can then use the same memory management environment.

The same thread handle must be used by multiple threads calling RpcSsAllocate and RpcSsFree in order 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 RpcSsGetThreadHandle to obtain a thread handle for this environment. Then, the spawned threads call RpcSsSetThreadHandle with the handle provided by the parent thread.

The RpcSsGetThreadHandle routine is usually called by a server manager procedure before additional threads are spawned. The stub sets up the memory management environment for the manager procedure, and the manager calls RpcSsGetThreadHandle to make this environment available to the other threads.

A thread can also call RpcSsGetThreadHandle and RpcSsSetThreadHandle to save and restore its memory management environment.

 

Note  The RpcSsGetThreadHandle routine raises exceptions, while the RpcSmGetThreadHandle routine returns the error code.

 

Return Values

Value

Meaning

RPC_S_OK

Success

 

See Also

RpcSmGetThreadHandle, RpcSsAllocate, RpcSsFree, RpcSsSetThreadHandle