- Notifications
You must be signed in to change notification settings - Fork0
Running multiple tasks asynchronously. Multi-threading safely. TaskContainerManager is a .NET Core library. You must be including TaskContainerManager in an existing .NET Core application without installation additional components.
License
Vladimir-Novick/TaskContainer-Manager
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Start multiple asynchronous tasks .
By using TaskContainerManager, you can start multiple tasks at the different time and process them. TaskContainerManager is a .NET Core library.
You must be including TaskContainerManager in an existing .NET Core application without installation additional components
Global callback function:A callback function is executed after any task is finished
public static bool OnTaskExiFunctiont(String TaskName) { Console.WriteLine($"Task Completed : {TaskName} "); return true; }Task exit callback function:A callback function is executed all time if specific task finished.
public static bool CallBackFunction(String taskName) { Console.WriteLine($" ***** CallBack : {taskName}"); return true; }
TaskContainerManager taskContainer = new TaskContainerManager(); taskContainer.OnTaskExit = OnTaskExiFunctiont; taskContainer.Option = TaskContainerManager.Options.None; for (int i = 1; i < 5; i++) { int ii = i; string taskName = $"Task {ii}"; Task task = new Task(() => { PrintMessage(ii, taskName); }); // Create Task // Add task to Container . Task will be start automatically taskContainer.TryAdd(task, taskName, $"Task Description {i}", CallBackFunction); } taskContainer.WaitAll(); // Wait all scheduled tasksThis is brief API reference is organized by method type.
Add a task to container
public bool TryAdd(Task task, String taskName = null, String description = null , Func<String,bool> callBack = null)Wait All running tasks from container
public void WaitAll(List<String> taskNames) public void WaitAll()Set Task Status
public void SetCurrentStatus(string taskName, String CurrentStatus)Get current task status
public string GetCurrentStatus(string taskName)Get active task's statuses
public List<TaskItemStatus> GetStatuses()Wait Any Task
public void WaitAny()Get Task Count
public int Count()Check specific task is completed
public bool IsCompleted(String TaskName)Get task status by task name
public TaskStatus Status(String TaskName)Checking if task is exist on the container
public bool isExist(String taskName)Copyright (C) 2016-2018 by Vladimir Novickhttp://www.linkedin.com/in/vladimirnovick ,
vlad.novick@gmail.com ,http://www.sgcombo.com ,https://github.com/Vladimir-Novick
Copyright (C) 2016-2018 by Vladimir Novick http://www.linkedin.com/in/vladimirnovick , Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.About
Running multiple tasks asynchronously. Multi-threading safely. TaskContainerManager is a .NET Core library. You must be including TaskContainerManager in an existing .NET Core application without installation additional components.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.