rpc_ss_set_thread_handle(3) — Subroutines
NAME
rpc_ss_set_thread_handle - Sets the thread handle for either a newly created spawned thread or for a server that was formerly a client and is ready to be a client again
Used by server or possibly by client applications.
SYNOPSIS
#include <dce/rpc.h>
void rpc_ss_set_thread_handle (
rpc_ss_thread_handle_t id
);
PARAMETERS
Input
idSpecifies a thread handle returned by a call to rpc_ss_get_thread_handle.
DESCRIPTION
The rpc_ss_set_thread_handle routine is used by a thread spawned in the manager code to associate itself with the main RPC manager thread. Each spawned thread that uses the rpc_ss_allocate and rpc_ss_free routines for memory management must call the rpc_ss_set_thread_handle routine, using the handle that the main RPC manager thread obtained through the rpc_ss_get_thread_handle routine.
The rpc_ss_set_thread_handle routine can also be used by a program that originally was a client, then became a server, and is now reverting to a client. The program must re-establish the client environment by calling the rpc_ss_set_thread_handle routine, supplying the handle it received (through the rpc_ss_get_thread_handle routine) prior to becoming a server as a parameter.
RETURN VALUES
An exception, rpc_x_no_memory, when there is insufficient memory available to set up necessary data structures.
EXAMPLE
When this function is invoked within a spawned thread, its argument is the thread handle of the calling thread. This example assumes the data passed to the thread consists of only the middle thread.
#include <pthread.h>
#include <dce/idlbase.h>
int helper_thread (
pthread_addr_t th
)
{
/∗
∗ Set the memory management environment to match
∗ the parent environment.
∗/
rpc_ss_set_thread_handle(rpc_ss_thread_handle_t)th;
/∗
∗ Real work of this thread follows here ...
∗/
}
RELATED INFORMATION
Functions: rpc_ss_get_thread_handle(3), rpc_ss_allocate(3), rpc_ss_free(3)