Threading in ORBLink


The IDL associated with threading is in the ORBLink:ORB pseudoInterface.

module ORBLink{
  pseudo interface ORB : CORBA::ORB {
    enum thread_policy_type {singly_threaded, thread_per_request};
    attribute thread_policy_type thread_policy;	
  };
};

The enum statement encodes the fact that there is a type named ORBLink:thread_policy_type comprising the keywords :singly_threaded and :thread_per_request.

Thus:

	(typep :singly_threaded 'orblink:thread_policy_type)
--> T

The ORB has an attribute named thread_policy whose value is always a member of that type.

The value of the attribute can be retrieved as follows:

	(op:thread_policy corba:orb)
--> :THREAD_PER_REQUEST

The value of the attribute can be set using standard setf syntax:

	(setf (op:thread_policy corba:orb) :thread_per_request)

Thus, the IDL definitions describe how to access certain values but they do not describe the meaning of the values themselves; that is the purpose of this document.

When the ORB handles an incoming request, it spawns a separate Lisp thread, an instance of mp:process, if the value of the thread_policy attribute of corba:orb is :thread_per_request .

This is the default and is the recommended settings. If the value of the attribute is set to :singly_threaded, however, then the request is executed in the same thread as was used to read the request from the wire.