Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IxInstancePinLock"/> class.
        /// </summary>
        /// <param name="target">IndirectX instance.</param>
        public IxInstancePinLock(IIxInstance target)
        {
            Critical.Assert(target != null, "Pin lock target should not be null.");

            Target = target;

            lock (target.ProviderNode.Host.InstanceTreeSyncRoot)
            {
                Target.AddLock(this);
            }
        }
Example #2
0
        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);
            }
        }
Example #3
0
        /// <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);
            }
        }