[omniORB] question re: threading

David Riddoch djr@uk.research.att.com
Thu, 4 Nov 1999 16:55:47 +0000 (GMT)


On Thu, 4 Nov 1999, Rob Cecil wrote:

> Could you please give a snippet code example that would demonstrate case #2:
> 
> > You just need to ensure that you serealise you calls into non-thread-safe
> > libraries with a mutex or something.  Alternatively you can serealise your
> > CORBA calls by holding a mutex in every implemented operation.

static omni_mutex the_lock;

void
MyImplClass::an_operation(an_arg_type an_arg)
{
  omni_mutex_lock sync(the_lock);

  // ... the body of the function as normal ...
}


You just need to do that for each of the methods in your object
implementation.  The 'omni_mutex_lock' holds onto the mutex as long as it
is in scope.  All methods should use the same mutex.  However you must be
careful to avoid dead-lock; you cannot call another method which grabs
that mutex from a method which is already holding the mutex.


> What is the release ETA for omniORB3?

It is already available via CVS and appears to be stable (unless anyone
can tell me otherwise).  Final release is likely to be the end of the
year, because I think we are planning to merge the GIOP 1.2 stuff in
before then.


> > If you use omniORB 3 (available via CVS and snapshots) you will be able to
> > have single-threaded object implementations or multi-threaded ones, as
> > described in the POA specification.


David