VMS Help  —  DCE  DCE_RPC, Application Routines, rpc_ss_set_thread_handle
 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

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

 RELATED INFORMATION

   Functions: rpc_ss_get_thread_handle
              rpc_ss_allocate
              rpc_ss_free

   Books: OSF DCE Application Development Guide
Close Help