Exemplo n.º 1
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);
        }
Exemplo n.º 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);
        }