Expand Minimize

RpcSsSetThreadHandle function

The RpcSsSetThreadHandle function sets a thread handle for the stub memory–management environment.

Syntax


void RPC_ENTRY RpcSsSetThreadHandle(
  RPC_SM_THREAD_HANDLE Handle
);

Parameters

Handle

Thread handle returned by a call to RpcSsGetThreadHandle.

Return value

This function does not return a value.

Remarks

An application calls RpcSsSetThreadHandle to set a thread handle for the stub memory–management environment. A thread used to manage memory for the stub memory–management environment calls RpcSsGetThreadHandle to obtain 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.

Typically, a thread spawned by a server manager procedure calls RpcSsSetThreadHandle. The stub sets up the memory-management environment for the manager procedure, and the manager calls RpcSsGetThreadHandle to obtain a thread handle. Then, each spawned thread calls RpcSsGetThreadHandle to get access to the manager's memory-management environment.

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

Note  The RpcSsSetThreadHandle routine raises exceptions, while the RpcSmSetThreadHandle routine returns the error code.

Windows Phone 8.1: This API is supported.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps | Windows Store apps]

Minimum supported server

Windows 2000 Server [desktop apps | Windows Store apps]

Header

Rpcndr.h (include Rpc.h)

Library

Rpcrt4.lib

DLL

Rpcrt4.dll

See also

RpcSmSetThreadHandle
RpcSsAllocate
RpcSsFree
RpcSsGetThreadHandle

 

 

Community Additions

ADD
Show:
© 2014 Microsoft