_statusUpdateQueue.CompleteAdding();
}
+ }
+
+ public class JobAgent:Agent<Action>
+ {
+ protected JobAgent(Action<Agent<Action>> action)
+ :base(action)
+ {
+
+ }
+
+ public static JobAgent Create()
+ {
+ return (JobAgent)Start(queue =>
+ {
+ Action loop = null;
+ loop = () =>
+ {
+ var job = queue.Receive();
+ job.ContinueWith(t =>
+ {
+ t.IgnoreExceptions();
+ var action = job.Result;
+ action();
+ queue.DoAsync(loop);
+ });
+ };
+ loop();
+ });
+ }
+
}
}