示例#1
0
        /// <summary>
        /// Constructs a new ActorContext.
        /// </summary>
        /// <param name="system">the ActorSystem within which the actor is created</param>
        /// <param name="actorType">the Type of the actor</param>
        /// <param name="actor">the Actor to create</param>
        /// <param name="name">the string name to give the Actor</param>
        /// <param name="props">the Props to pass individually as class arguments</param>
        /// <param name="parent">the ActorRef of the parent of the Actor being created</param>
        /// <param name="parentPath">the ActorPath of the Actor being created</param>
        /// <param name="suspended">the bool indicating whether the actor is being created as suspended</param>
        /// <param name="channel">the IChannel the actor will use</param>
        /// <param name="fiber">the IFiber the actor will use</param>
        internal ActorContext(
            ActorSystem system,
            Type actorType,
            Actor actor,
            string name,
            Props props,
            ActorRef parent,
            ActorPath parentPath,
            bool suspended,
            IChannel<Delivery> channel,
            IFiber fiber)
        {
            Actor = actor;
            Actor.InternalContext = this;
            Channel = channel;
            Fiber = fiber;
            Children = new List<ActorRef>(0);
            Parent = parent;
            Path = parentPath.WithName(name);
            Props = props;
            Receivers = new Stack<Receive>(1);
            Self = new ActorRef(this);
            Sender = ActorRef.NoSender;
            _Suspended = suspended;
            System = system;
            _Terminated = false;
            Type = actorType;

            Start();
        }
示例#2
0
 /// <summary>
 /// Constructs a new ActorContext.
 /// </summary>
 /// <param name="system">the ActorSystem within which the actor is created</param>
 /// <param name="actor">the Actor to create</param>
 /// <param name="name">the string name to give the Actor</param>
 /// <param name="props">the Props to pass individually as class arguments</param>
 /// <param name="parent">the ActorRef of the parent of the Actor being created</param>
 /// <param name="parentPath">the ActorPath of the Actor being created</param>
 internal ActorContext(
     ActorSystem system,
     Type actorType,
     Actor actor,
     string name,
     Props props,
     ActorRef parent,
     ActorPath parentPath)
     : this(system, actorType, actor, name, props, parent,
            parentPath, false, new Channel<Delivery>(), new PoolFiber())
 {
 }