private StopPhaseWorkCounter(StopPhaseWorkCounter parent, Thread creatingThread)
            : this(Thread.CurrentThread)
        {
            if(!ReferenceEquals(_ownerThread, creatingThread))
                throw new ArgumentException(
                    $"Initialization of a child counter should happen in the same thread '{_ownerThread.Name}' as parent '{creatingThread.Name}'.");

            _ownerThread = creatingThread;
            parent._children.Add(this);
        }
Exemple #2
0
        private StopPhaseWorkCounter(StopPhaseWorkCounter parent, Thread creatingThread)
            : this(Thread.CurrentThread)
        {
            if (!ReferenceEquals(_ownerThread, creatingThread))
            {
                throw new ArgumentException(
                          $"Initialization of a child counter should happen in the same thread '{_ownerThread.Name}' as parent '{creatingThread.Name}'.");
            }

            _ownerThread = creatingThread;
            parent._children.Add(this);
        }