private WorkPool StartNewWorkPool(IModel model) { var newWorkPool = new WorkPool(); newWorkPool.Start(); return(newWorkPool); }
private static WorkPool StartNewWorkPool(IModel model) { var newWorkPool = new WorkPool(model as ModelBase); newWorkPool.Start(); return(newWorkPool); }
private WorkPool StartNewWorkPool(IModel model) { var newWorkPool = new WorkPool(model, _concurrency); newWorkPool.Start(); return(newWorkPool); }
public void AddWork(IModel model, Action fn) { // two step approach is taken, as TryGetValue does not aquire locks // if this fails, GetOrAdd is called, which takes a lock if (workPools.TryGetValue(model, out WorkPool workPool) == false) { var newWorkPool = new WorkPool(model); workPool = workPools.GetOrAdd(model, newWorkPool); // start if it's only the workpool that has been just created if (newWorkPool == workPool) { newWorkPool.Start(); } } workPool.Enqueue(fn); }
public void Schedule <TWork>(ModelBase model, TWork work) where TWork : Work { // two step approach is taken, as TryGetValue does not aquire locks // if this fails, GetOrAdd is called, which takes a lock if (workPools.TryGetValue(model, out WorkPool workPool) == false) { var newWorkPool = new WorkPool(model); workPool = workPools.GetOrAdd(model, newWorkPool); // start if it's only the workpool that has been just created if (newWorkPool == workPool) { newWorkPool.Start(); } } workPool.Enqueue(work); }
public void AddWork(IModel model, Action fn) { // two step approach is taken, as TryGetValue does not aquire locks // if this fails, GetOrAdd is called, which takes a lock WorkPool workPool; if (workPools.TryGetValue(model, out workPool) == false) { var newWorkPool = new WorkPool(model); workPool = workPools.GetOrAdd(model, newWorkPool); // start if it's only the workpool that has been just created if (newWorkPool == workPool) { newWorkPool.Start(); } } workPool.Enqueue(fn); }