ONC+ RPC Developer's Guide

Exit Print View

Updated: July 2014
 
 

MT User Mode

In MT User mode, the RPC library does not create any threads. This mode works, in principle, like the single-threaded, or default mode. The only difference is that it passes copies of data structures, such as the transport service handle to the service-dispatch routine to be MT safe.

The RPC server developer takes the responsibility for creating and managing threads through the thread library. In the dispatch routine, the service developer can assign the task of procedure execution to newly created or existing threads. The thr_create() API is used to create threads having various attributes. All thread library interfaces are defined in /usr/include/thread.h and /usr/include/pthread.h.

This mode provides flexibility to the service developer. Threads can now have different stack sizes based on service requirements. Threads can be bound. Different procedures can be executed by threads with different characteristics. The service developer might choose to run some services single threaded. The service developer might choose to do special thread-specific signal processing.

As in the Auto mode, you use the rpc_control() library call to turn on User mode. Note that the rpc_control() operations shown in Table 7–1, except for RPC_SVC_MTMODE_GET(), apply only to MT Auto mode. If used in MT User mode or the single-threaded default mode, the results of the operations can be undefined.