In ExternalSemaphoreTable I noticed two class variables set by class
initialization as:
   ProtectAdd := Semaphore forMutualExclusion.
   ProtectRemove := Semaphore forMutualExclusion

and I'm curious, what are the TWO shared resources that these TWO are
meant to protect?  it seems there is only one, that being
unprotectedExternalObjects.

I notice that "ExternalSemaphoreTable class>>safelyUnregisterExternalObject:"
stores unprotectedExternalObjects in its local variable "objects"
and then up removes an object from it.

But "ExternalSemaphoreTable class>>safelyRegisterExternalObject:"
also stores unprotectedExternalObjects in its local variable "objects"
which it then passes to "ExternalSemaphoreTable
class>>collectionBasedOn:withRoomFor:"
which takes a copy to grow a new collection to store into
unprotectedExternalObjects.

Even though its a rare case that the external semaphore might grow at
just the same time that an object is being unregistered, and also
practically #safelyUnregisterExternalObject: might not be preemptable,
this smells bad having two mutual exclusions covering one resource -
thus no mutual exclusion at all.  Is there something I'm missing?

cheers -ben

Reply via email to