/// <summary> /// 内部使用的,发送数据 /// </summary> /// <param name="cmd"></param> protected void SendToOutput(ActorCmd cmd) { lock (mOutputLock) { mOutput.Enqueue(cmd); } }
/// <summary> /// 内部使用的输入数据 /// </summary> /// <param name="cmd"></param> protected void InsideInput(ActorCmd cmd) { if (Disposed) { throw new ObjectDisposedException(Name); } lock (mInput) { mInput.Enqueue(cmd); } }
/// <summary> /// 输入数据 /// </summary> /// <param name="cmd"></param> public void Input(ActorCmd cmd) { if (Disposed) { throw new ObjectDisposedException(Name); } lock (mInput) { if (OnInput(cmd)) { mInput.Enqueue(cmd); } } }
/// <summary> /// 当有Cmd进来时,会执行这个 /// </summary> /// <param name="cmd"></param> /// <returns></returns> protected abstract ThreadResult OnCmd(ActorCmd cmd);
/// <summary> /// 对输入的数据进行预处理 /// </summary> /// <param name="cmd"></param> /// <returns>如果返回false, 由不把这个命名添加到列表中去</returns> protected abstract bool OnInput(ActorCmd cmd);