Akka.Remote.RemoteSystemDaemon.AddChildParentNeedsWatch C# (CSharp) Метод

AddChildParentNeedsWatch() приватный Метод

private AddChildParentNeedsWatch ( IActorRef parent, IActorRef child ) : bool
parent IActorRef
child IActorRef
Результат bool
        private bool AddChildParentNeedsWatch(IActorRef parent, IActorRef child)
        {
            const bool weDontHaveTailRecursion = true;
            while (weDontHaveTailRecursion)
            {
                if (_parent2Children.TryAdd(parent, ImmutableHashSet<IActorRef>.Empty.Add(child)))
                    return true; //child was successfully added

                IImmutableSet<IActorRef> children;
                if (_parent2Children.TryGetValue(parent, out children))
                {
                    if (_parent2Children.TryUpdate(parent, children.Add(child), children))
                        return false; //child successfully added
                }
            }
        }