Suspending a method execution

Gary D. Duzan gdd0@gte.com
Fri, 27 Feb 1998 15:36:30 -0500


In Message <34F70B6E.9B3@c-lab.de> ,
   Jan Lessner <jan@c-lab.de> wrote:

=>Hello all
=>A while ago I learned that omniORB creates a separate thread for every
=>single implementation object for its request dispatching.

   The basis for your question is flawed. This is not, in fact, the
threading model used in OmniORB. Rather, it uses a thread-per-client-
connection model. There can be from zero to an arbitrarily large number
of threads associated with an implementation object at any given time,
depending on the number of clients operating on it. For details see the
documentation with OmniORB 2.4.0, the chapter on Connection Management,
and the section entitled The Model.

=>                                                          Now I'd like
=>to provide a server which delays method executions depending on other
=>external events. Therefore I'd like to suspend the thread which is
=>related to an object while it executes one of this object's methods.
=>Unfortunately I didn't find any link (pointer, member, some "current
=>thread" variable, what ever) from the implementation object to its
=>related dispatcher thread object.

   While the object is running, you should be able to call
omni_thread::self() to get the omni_thread object which represents the
current thread. Or if you just want to delay execution for a certain
length of time, there is omni_thread::sleep(). However, you are
probably better off looking at omni_mutex, omni_condition, etc. From
your statements I'd guess that you also want to make sure only one
thread is running in an object at a time, which requires a mutex.

					Gary Duzan
					GTE Laboratories