예제 #1
0
 public ActiveObject(ILoopsFactory factory, Action <T> action,
                     int capacity,
                     TimeSpan interval = new TimeSpan())
 {
     _loop     = factory.Create(LoopAction, interval);
     _queue    = new BlockingCollection <Message>(new ConcurrentQueue <Message>());
     _action   = action;
     _capacity = capacity;
     _interval = interval;
 }
예제 #2
0
 public static IStatefullLoop <T> CreateWith <T>(this ILoopsFactory factory, Action <CancellationToken, T> action, TimeSpan timeout = new TimeSpan())
 {
     return(new StatefullLoop <T>(factory.Create(c => { }, timeout)).Loop(action));
 }