[omniORB] Thread-safety of Any with local calls

Duncan Grisby duncan@grisby.org
Fri Oct 4 17:05:01 2002


On Thursday 3 October, Chris Newbold wrote:
> On Mon, 2002-09-30 at 09:37, Duncan Grisby wrote:
> 
> > All is not lost, however. If you use the omniORB specific Any
> > constructor that takes a void* argument, you can copy an Any without
> > copying its underlying buffer. Use code like
> > 
> >   CORBA::Any* a = // something in concurrent use
> >   CORBA::Any safe(a->type(), a->value())
> 
> Perhaps I read more into this statement than was intended, but it looks
> like while the constructor which takes a void* is thread-safe, the call
> to value() is not.

value() is thread safe relative to other threads reading the Any, but
not to other threads writing to it. All value() does is return a
pointer to the underlying memory buffer storing the marshalled form of
the Any.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan@grisby.org     --
   -- http://www.grisby.org --