void checkNodeIlegal(ActorNode node) { if (node == null) { return; } string trace = "\nat " + node.Trace; var now = node; node = node.Parent; while (node != null) { trace += "\nat " + node.Trace; if (now.Actor == node.Actor) { LOGGER.Fatal("actor dead lock:" + trace); //throw new Exception(string.Format("actor dead lock:{0}", trace)); } node = node.Parent; } }
public Task <T> SendAsync <T>(Func <T> work, bool checkLock, int timeOut) { FuncWrapper <T> at = new FuncWrapper <T>(work); at.TimeOut = timeOut; lock (nodeLock) { int thId = TaskScheduler.Current.Id; var newNode = new ActorNode(); if (threadMap.ContainsKey(thId)) { newNode.Parent = threadMap[thId].activeNode; } newNode.Actor = cacheActor; if (work.Target == null || work.Method.DeclaringType.Name.Contains("<>c")) { newNode.Trace = work.Method.DeclaringType.FullName + ":" + work.Method.Name + "(" + work.ToString() + ")"; } else { newNode.Trace = work.Target.GetType().FullName + ":" + work.Method.Name + "(" + work.ToString() + ")"; } if (checkLock) { checkNodeIlegal(newNode); } else { newNode.Parent = null; } at.Node = newNode; } actionBlock.SendAsync(at); return(at.Tcs.Task); }
public void SetActiveNode(ActorNode node) { checkActor.SetActiveNode(node); }