implementation thread race

Sai-Lai Lo S.Lo@orl.co.uk
Thu, 4 Dec 1997 16:20:42 GMT


>>>>> Renzo Tomaselli writes:

> I'm trying to figure out what happens when two or more server threads are
> in a race because one of them is executing an object method which invokes
> _dispose() while other threads are executing methods of the same object.
> Does the ORB protect itself from such a case (for instance by postponing
> _dispose() until the object is not busy) ? The implementation can protect
> itself by some form of mutual exclusion, however serializing all methods
> would be almost unfeasible because of performance reasons. Such race
> conditions can happen when clients threads share the same object  (think of
> naming clients where one binds a naming context while another one destroys
> it).

As I wrote in the user guide, a call to _dispose() will only cause the
object to be deleted when the reference count on the object goes to
zero. The reference count is not zero if there are colocated object
references in existence. Also an incoming call from a remote address spaces
would cause the reference count to go up by 1 until the call has completed.

To answer your question, the ORB does do the right thing in the race
condition you described.

Regards,

Sai-Lai