{"id":19798578,"url":"https://github.com/guildofcalamity/concurrentutils","last_synced_at":"2026-06-08T13:31:40.831Z","repository":{"id":256645952,"uuid":"856016952","full_name":"GuildOfCalamity/ConcurrentUtils","owner":"GuildOfCalamity","description":"Concurrent utility library for Task","archived":false,"fork":false,"pushed_at":"2024-09-12T21:19:18.000Z","size":319,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T16:44:18.235Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GuildOfCalamity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-11T20:57:22.000Z","updated_at":"2024-09-12T21:19:21.000Z","dependencies_parsed_at":"2024-09-12T07:18:30.052Z","dependency_job_id":"2c45d709-b39d-48a5-b87b-6f42e97c6eb4","html_url":"https://github.com/GuildOfCalamity/ConcurrentUtils","commit_stats":null,"previous_names":["guildofcalamity/concurrentutils"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GuildOfCalamity/ConcurrentUtils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuildOfCalamity%2FConcurrentUtils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuildOfCalamity%2FConcurrentUtils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuildOfCalamity%2FConcurrentUtils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuildOfCalamity%2FConcurrentUtils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GuildOfCalamity","download_url":"https://codeload.github.com/GuildOfCalamity/ConcurrentUtils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuildOfCalamity%2FConcurrentUtils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34065348,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T07:30:33.901Z","updated_at":"2026-06-08T13:31:40.811Z","avatar_url":"https://github.com/GuildOfCalamity.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# C# Concurrent Utilities\n\n---\n\n### I have ported this entire project and made it usable from the old `xproj` format. I have made this a multi-framework project (.NET 4.8.1 \u0026 .NET 6.0) and also applied fixes and improvements where needed.\n### The original can be found [here](https://github.com/jorgebay/concurrent-utils).\n\n---\n\nProvides classes and methods useful in concurrent programming.\n\n## Functionalities\n\n### `Times(long times, int limit, Func\u003clong, Task\u003e method)`\n\nExecutes an asynchronous method n number of times, limiting the amount of operations in parallel without blocking.\n\nReturns a `Task` that is completed when all Tasks are completed or is faulted when any of the Tasks transition to\nfaulted state.\n\nSuitable for benchmarking asynchronous methods with different maximum amount of parallel operations.\n\n**Example**\n\n```csharp\n// Execute MyMethodAsync 1,000,000 times limiting the maximum amount of parallel async operations to 512\nawait ConcurrentUtils.Times(1000000, 512, (index) =\u003e MyMethodAsync());\n```\n\n### `Map(IList\u003cTSource\u003e source, int limit, Func\u003cTSource, Task\u003cTResult\u003e\u003e method)`\n\nAsynchronously projects each element of a sequence into a new form, limiting the amount of operations in parallel\nwithout blocking.\n\nReturns a `Task` that gets completed with the transformed elements or faulted when any of the transformation\noperations transition to faulted state.\n\n**Example** \n\n```csharp\nvar urls = new []\n{\n    \"https://www.google.com/\",\n    \"https://www.microsoft.com/net/core\",\n    \"https://www.nuget.org/\",\n    \"https://dotnet.github.io/\"\n};\n// Asynchronously get the http response of each url limiting\n// the maximum amount of parallel http requests to 2\nstring[] responses = await ConcurrentUtils.Map(urls, 2, url =\u003e client.GetStringAsync(url));\n```\n\n### `CreateQueue\u003cT\u003e(int limit, Func\u003cT, Task\u003e method)`\n\nCreates collection of objects to which apply the asynchronous method in a first-in first-out manner. Items added to\nthe queue are processed in parallel according to the given limit.\n\nReturns a `IJobQueue\u003cT\u003e` instance that can be used to enqueue items.\n\n**Example** \n\n```csharp\n// Create the queue providing the method that is going to be used to asynchronously process each item\n// and the max amount of parallel operations (in this case 2)\nIJobQueue\u003cstring\u003e jobQueue = ConcurrentUtils.CreateQueue(2, url =\u003e client.GetStringAsync(url));\n// Add items to the queue that are going to be processed\nTask t1 = jobQueue.Enqueue(\"https://www.google.com/\");\nTask t2 = jobQueue.Enqueue(\"https://www.microsoft.com/net/core\");\nTask t3 = jobQueue.Enqueue(\"https://www.nuget.org/\");\nTask t4 = jobQueue.Enqueue(\"https://dotnet.github.io/\");\n// Items are processed as FIFO queue, without exceeding the max amount of parallel operations limit\nawait Task.WhenAll(t1, t2, t3, t4);\n```\n\n---\n\n![console](Screenshot.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguildofcalamity%2Fconcurrentutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguildofcalamity%2Fconcurrentutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguildofcalamity%2Fconcurrentutils/lists"}