public IxInstanceChildLock(IIxInstance parent, IIxInstance child) { if (parent == null) { throw new ArgumentNullException(nameof(parent)); } if (child == null) { throw new ArgumentNullException(nameof(child)); } Target = parent; Owner = child; lock (Target.ProviderNode.Host.InstanceTreeSyncRoot) { Target.AddLock(this); Owner.AddOwnedLock(this); } }
/// <summary> /// Initializes a new instance of the <see cref="IxReferenceLock"/> class. /// </summary> /// <param name="target">The instance to lock.</param> /// <param name="owner">The owner of this lock.</param> public IxReferenceLock(IIxInstance target, IIxInstance owner) { if (target == null) { throw new ArgumentNullException(nameof(target)); } if (owner == null) { throw new ArgumentNullException(nameof(owner)); } Critical.Assert(!ReferenceEquals(target, owner), "Cannot create reference from self to self."); Target = target; Owner = owner; lock (Target.ProviderNode.Host.InstanceTreeSyncRoot) { Target.AddLock(this); Owner.AddOwnedLock(this); } }