PreviousNext

rpc_ss_set_thread_handle(3rpc)

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

id
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 rpc_ss_allocate( ) and rpc_ss_free( ) for memory management must call rpc_ss_set_thread_handle( ), using the handle that the main RPC manager thread obtained through rpc_ss_get_thread_handle( ).

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 rpc_ss_get_thread_handle( )) 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.

Examples
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 ...
*/
}

Errors

A representative list of errors that might be returned is not shown here. Refer to the OSF DCE Problem Determination Guide for complete descriptions of all error messages.

Related Information
Functions: rpc_ss_get_thread_handle(3rpc)

rpc_ss_allocate(3rpc)

rpc_ss_free(3rpc)

Books: OSF DCE Application Development Guide - Core Components