Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ rpc_ss_get_thread_handle(3) — OSF1 1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

rpc_ss_allocate(3)

rpc_ss_free(3)

rpc_ss_set_thread_handle(3)

rpc_ss_get_thread_handle(3)  —  Subroutines

NAME

rpc_ss_get_thread_handle - Gets a thread handle for the manager code before it spawns additional threads, or for the client code when it becomes a server

Used by server or possibly by client applications. 

SYNOPSIS

#include <dce/rpc.h>
rpc_ss_thread_handle_t  rpc_ss_get_thread_handle(void);

PARAMETERS

None. 

DESCRIPTION

The rpc_ss_get_thread_handle routine is used by a server manager thread when it spawns additional threads. To spawn additional threads that are able to perform memory management, the server manager code calls rpc_ss_get_thread_handle and passes the the thread handle to each spawned thread. Each spawned thread that uses the rpc_ss_allocate and rpc_ss_free routines for memory management must first call the rpc_ss_set_thread_handle routine, using the handle obtained by the original manager thread. 

The rpc_ss_get_thread_handle routine can also be used when a program changes from being a client to being a server.  The program gets a handle on its environment as a client by calling rpc_ss_get_thread_handle. When the program reverts to being a client it reestablishes the client environment by calling the rpc_ss_set_thread_handle routine, supplying the previously obtained handle as a parameter. 

RETURN VALUES

A thread handle. 

EXAMPLE

This function determines the thread handle, creates a thread, and passes the thread handle to the thread so it can share the memory management environment of the calling thread. 

#include <pthread.h>
#include <idlbase.h>
 pthread_t Launch_thread(
    int (∗routine_to_launch)(
       pthread_addr_t th
       )
    )
{
    rpc_ss_thread_handle_t th = rpc_ss_get_thread_handle();
    pthread_t t;
     /∗
     ∗ Create the thread and pass to it the thread handle
     ∗ so it can use rpc_ss_set_thread_handle.
     ∗/
    pthread_create (&t, pthread_attr_default,
        (pthread_startroutine_t)routine_to_launch,
        (pthread_addr_t)th);
 
    return t;
}

RELATED INFORMATION

Functions: rpc_ss_allocate(3), rpc_ss_free(3), rpc_ss_set_thread_handle(3)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026