public static ActionBlockExecutorSettings DefaultWith(bool supportSynchronizationContext = true) { var settings = new ActionBlockExecutorSettings(); settings.SupportSynchronizationContext = supportSynchronizationContext; return(settings); }
public ActionBlockExecutor(string name, ActionBlockExecutorSettings settings) { this.name = name; this.supportSynchronizationContext = settings.SupportSynchronizationContext; this.queue = new ActionBlock<Action>(a => { ExecuteAction(a); }, new ExecutionDataflowBlockOptions { BoundedCapacity = settings.QueueBoundedCapacity, MaxDegreeOfParallelism = settings.MaxDegreeOfParallelism }); }
public ActionBlockExecutor(string name, ActionBlockExecutorSettings settings) { this.name = name; this.supportSynchronizationContext = settings.SupportSynchronizationContext; if (settings.QueueBoundedCapacity <= 0) col = new BlockingCollection<Action>(); else col = new BlockingCollection<Action>(settings.QueueBoundedCapacity); tcs = new TaskCompletionSource<int>(); runner = new Thread(new ThreadStart(Run)); runner.IsBackground = true; runner.Start(); }
public ActionBlockExecutor(string name, ActionBlockExecutorSettings settings) { this.name = name == null ? string.Empty : name; this.supportSynchronizationContext = settings.SupportSynchronizationContext; this.queue = new ActionBlock <Action>(a => { if (stopImmediately) { return; } ExecuteAction(a); }, new ExecutionDataflowBlockOptions { BoundedCapacity = settings.QueueBoundedCapacity, MaxDegreeOfParallelism = settings.MaxDegreeOfParallelism, }); }
public ActionBlockExecutor(string name, ActionBlockExecutorSettings settings) { this.name = name == null ? string.Empty : name; this.supportSynchronizationContext = settings.SupportSynchronizationContext; if (settings.QueueBoundedCapacity <= 0) { col = new BlockingCollection <Action>(); } else { col = new BlockingCollection <Action>(settings.QueueBoundedCapacity); } tcs = new TaskCompletionSource <int>(); runner = new Thread(new ThreadStart(Run)); runner.IsBackground = true; runner.Start(); }
public static ActionBlockExecutorSettings DefaultWith(bool supportSynchronizationContext = true) { var settings = new ActionBlockExecutorSettings(); settings.SupportSynchronizationContext = supportSynchronizationContext; return settings; }