public static void ReadyToExecute(IActor actor) { if (actor.Exited) { return; } var actorStatus = Interlocked.CompareExchange( ref actor.Context.Status, ActorContext.EXECUTING, ActorContext.AVAILABLE); if (actorStatus == ActorContext.AVAILABLE) { Task.Factory.StartNew(() => GateKeeper.Execute(actor)); } }
/// <summary> /// For the client to give a work item to the actor. /// </summary> /// <param name="item"></param> public void AddWorkItem(T item) { _queue.Enqueue(item); GateKeeper.ReadyToExecute(this); }