{"id":11220678,"name":"github.com/b97tsk/async","ecosystem":"go","description":"Package async is a library for asynchronous programming.\n\nSince Go has already done a great job in bringing green/virtual threads\ninto life, this library only implements a single-threaded Executor type,\nwhich some refer to as an async runtime.\nOne can create as many executors as they like.\n\nWhile Go excels at forking, async, on the other hand, excels at joining.\n\nWanted to execute pieces of code from goroutines in a single-threaded way?\n\nAn Executor is designed to be able to run tasks spawned in goroutines\nsequentially.\nThis comes in handy when one wants to do a series of operations\non a single thread, for example, to read or update states that are not\nsafe for concurrent access, to write data to the console or a file, to\nupdate one's user interfaces, etc.\n\nBe aware that there is no back pressure.\nTask spawning isn't designed to block.\nIf spawning outruns execution, an Executor can easily consume a lot of\nmemory over time.\nTo mitigate, one could introduce a semaphore per hot spot.\n\nAn async Task can be reactive.\n\nAn async Task is spawned with a Coroutine to take care of it.\nIn this user-provided function, one can return a specific Result to tell\na coroutine to watch and await some events (e.g. Signal, State, etc.),\nand the coroutine can just re-run the task whenever any of these events\nnotifies.\n\nThis is useful when one wants to do something repeatedly.\nIt works like a loop. To exit this loop, just return a Result that does\nsomething different from within the task function. Simple.\n\nA Coroutine can also make a transition from one Task to another, just\nlike a state machine can make a transition from one state to another.\nThis is done by returning another specific Result from within a task\nfunction.\nA coroutine can transition from one task to another until a task ends it.\n\nWith the ability to transition, async is able to provide more advanced\ncontrol structures, like Block, Loop and Func, to ease the process of\nwriting async code. The experience now feels similar to that of writing sync\ncode.\n\nAsync encourages non-blocking programming, which makes structured concurrency\nquite essential to this library.\nAt some point, one might want to know when an Executor stops operating.\n\nIn Go, all Go code can only be executed by goroutines.\nAsync tasks are just ordinary Go functions, too.\nIf one keeps track of every goroutine that spawns async tasks, and waits for\nthem to finish, then the exact right time when an Executor stops operating\ncan be determined too.\nEssentially, it creates a synchronization point between the spawned tasks\nand the rest of the code after the waiting.\n\nCoroutines spawned by an Executor are root coroutines.\nCoroutines spawned by the Coroutine.Spawn method, in a Task function,\nare child coroutines.\n\nChild coroutines are Task-scoped and, therefore, cancelable.\nWhen a coroutine resumes, or finishes a Task, all spawned child coroutines\nare canceled.\n\nConversely, root coroutines are not cancelable.\nOne must cooperatively tell a root coroutine to exit.\nThough, it's possible to just let them rot in the background. The Go runtime\nwould happily garbage collect them when there are no references to them.\n\nWhen a child coroutine is canceled, it runs to completion with all yield\npoints treated like exit points.\nHowever, within a NonCancelable context, a canceled child coroutine is\nallowed to yield, which would correspondingly cause its parent coroutine to\nyield, too. In such case, the parent coroutine stays suspended until all its\nchild coroutines are completed.\n\nFurther more, a (child) coroutine can also perform hard yields at any time.\nA hard yield is non-cancelable and does not require a NonCancelable\ncontext.\n\nChild coroutines propagate unrecovered panics to their parent coroutines.\nRoot coroutines propagate unrecovered panics to their Executor, causing\nthe Executor.Run method to panic when it returns.\n\nIf a coroutine spawns multiple child coroutines and one of them panics\nwithout recovering, the coroutine cancels other child coroutines.\nThen, after all child coroutines are completed, the coroutine propagates\npanics to its parent coroutine, or its Executor if it's a root coroutine.\n\nCoroutine unwinding is the process of removing structure controllers,\nsuch as Func, from the controller stack.\nDeferred tasks are run in last-in-first-out (LIFO) order, hence, the running\ncoroutine may still have a chance to yield during the process of unwinding.\n\nHere is the list of operations that may cause a coroutine to unwind:\n\n\nThis example demonstrates how a task can conditionally depend on a state.\n\n\nThis example demonstrates how to end a task.\nIt creates a task that prints the value of a state whenever it changes.\nThe task only prints 0, 1, 2 and 3 because it is ended after 3.\n\n\nThis example demonstrates how to set up an autorun function to run\nan async.Executor in a goroutine automatically whenever a coroutine is\nspawned or resumed.\n\n\nThis example demonstrates how async handles panics.\n\n\nThis example demonstrates how a coroutine can transition from one task to\nanother.","homepage":"https://github.com/b97tsk/async","licenses":"MIT","normalized_licenses":["MIT"],"repository_url":"https://github.com/b97tsk/async","keywords_array":[],"namespace":"github.com/b97tsk","versions_count":29,"first_release_published_at":"2024-12-25T10:57:18.000Z","latest_release_published_at":"2026-05-16T08:31:25.000Z","latest_release_number":"v0.20.1","last_synced_at":"2026-05-25T21:04:06.437Z","created_at":"2024-12-27T07:32:18.376Z","updated_at":"2026-05-25T21:04:06.438Z","registry_url":"https://pkg.go.dev/github.com/b97tsk/async","install_command":"go get github.com/b97tsk/async","documentation_url":"https://pkg.go.dev/github.com/b97tsk/async#section-documentation","metadata":{},"repo_metadata":{"id":269695686,"uuid":"908161857","full_name":"b97tsk/async","owner":"b97tsk","description":"A Go library for asynchronous programming.","archived":false,"fork":false,"pushed_at":"2025-09-27T10:04:37.000Z","size":248,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-27T12:08:16.491Z","etag":null,"topics":["async","async-await","coroutines","event-driven","single-threaded","state-machines"],"latest_commit_sha":null,"homepage":"","language":"Go","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/b97tsk.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-25T10:02:06.000Z","updated_at":"2025-09-27T10:04:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"1e49ef90-91e6-41a7-827b-d02dbf3600b6","html_url":"https://github.com/b97tsk/async","commit_stats":null,"previous_names":["b97tsk/async"],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/b97tsk/async","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/b97tsk","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277289861,"owners_count":25793384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-27T02:00:08.978Z","response_time":73,"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"},"tags":[{"name":"v0.13.0","sha":"6e4882c765efb8959c38fc5027e3a347e87fc501","kind":"commit","published_at":"2025-09-27T08:28:52.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.13.0","html_url":"https://github.com/b97tsk/async/releases/tag/v0.13.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.13.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.13.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.13.0/manifests"},{"name":"v0.12.0","sha":"b6cb1eae129580dc507ac75e470fe3e7a9ebbcd7","kind":"commit","published_at":"2025-08-30T08:49:26.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.12.0","html_url":"https://github.com/b97tsk/async/releases/tag/v0.12.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.12.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.12.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.12.0/manifests"},{"name":"v0.11.0","sha":"b5e68e4cd0505839dd0128f4ef4f120f7ca9a016","kind":"commit","published_at":"2025-08-02T08:52:40.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.11.0","html_url":"https://github.com/b97tsk/async/releases/tag/v0.11.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.11.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.11.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.11.0/manifests"},{"name":"v0.10.0","sha":"fd6d1a6c01259747ad44808c5bffaff37f9b40de","kind":"commit","published_at":"2025-07-26T06:55:58.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.10.0","html_url":"https://github.com/b97tsk/async/releases/tag/v0.10.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.10.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.10.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.10.0/manifests"},{"name":"v0.9.0","sha":"c15da69df75899131b2387781c1ffd2b89583bb8","kind":"commit","published_at":"2025-07-06T08:50:30.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.9.0","html_url":"https://github.com/b97tsk/async/releases/tag/v0.9.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.9.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.9.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.9.0/manifests"},{"name":"v0.8.0","sha":"85613f0e34b2ad64f5671a66ae5c80b02dafc3d4","kind":"commit","published_at":"2025-06-01T08:48:24.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.8.0","html_url":"https://github.com/b97tsk/async/releases/tag/v0.8.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.8.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.8.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.8.0/manifests"},{"name":"v0.7.0","sha":"a3303370136624884ab44cd92601c993746864ac","kind":"commit","published_at":"2025-05-11T08:56:48.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.7.0","html_url":"https://github.com/b97tsk/async/releases/tag/v0.7.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.7.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.7.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.7.0/manifests"},{"name":"v0.6.0","sha":"901c52114e3e6f92ceb071fc2d67c8a1b56c70cc","kind":"commit","published_at":"2025-05-04T08:59:25.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.6.0","html_url":"https://github.com/b97tsk/async/releases/tag/v0.6.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.6.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.6.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.6.0/manifests"},{"name":"v0.5.0","sha":"54a2980a11f1d8c576bbd097ead6e5ae8213a215","kind":"commit","published_at":"2025-04-27T08:31:45.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.5.0","html_url":"https://github.com/b97tsk/async/releases/tag/v0.5.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.5.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.5.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.5.0/manifests"},{"name":"v0.4.1","sha":"275459792cf5ea2799913c85f2584e959d9f940d","kind":"commit","published_at":"2025-04-13T08:30:27.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.4.1","html_url":"https://github.com/b97tsk/async/releases/tag/v0.4.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.4.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.4.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.4.1/manifests"},{"name":"v0.4.0","sha":"b1fff4c988b6f7b1ec338cf2a1916c8e07776b16","kind":"commit","published_at":"2025-04-06T08:52:48.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.4.0","html_url":"https://github.com/b97tsk/async/releases/tag/v0.4.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.4.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.4.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.4.0/manifests"},{"name":"v0.3.1","sha":"afa254cab1d04b2af1c4ac8e1ffabd5ba324455a","kind":"commit","published_at":"2025-03-30T08:36:52.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.3.1","html_url":"https://github.com/b97tsk/async/releases/tag/v0.3.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.3.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.3.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.3.1/manifests"},{"name":"v0.3.0","sha":"872efc27c90f9fa16ab64874b6840b7728d5ac02","kind":"commit","published_at":"2025-03-23T09:43:36.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.3.0","html_url":"https://github.com/b97tsk/async/releases/tag/v0.3.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.3.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.3.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.3.0/manifests"},{"name":"v0.2.1","sha":"012dfa7301fd3c74b7d7aaa603119b54fa321e95","kind":"commit","published_at":"2025-01-03T08:10:58.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.2.1","html_url":"https://github.com/b97tsk/async/releases/tag/v0.2.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.2.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.2.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.2.1/manifests"},{"name":"v0.2.0","sha":"beb59ca65eb7ce1cca395b8e7eab494ce7cee4ee","kind":"commit","published_at":"2024-12-30T10:27:20.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.2.0","html_url":"https://github.com/b97tsk/async/releases/tag/v0.2.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.2.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.2.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.2.0/manifests"},{"name":"v0.1.2","sha":"cb2830af86a519966fd376ca08a56c3bf1fd646c","kind":"commit","published_at":"2024-12-27T08:06:29.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.1.2","html_url":"https://github.com/b97tsk/async/releases/tag/v0.1.2","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.1.2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.1.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.1.2/manifests"},{"name":"v0.1.1","sha":"1ef7e96a90d55212b0648cb62847eca58a8c906c","kind":"commit","published_at":"2024-12-26T03:52:18.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.1.1","html_url":"https://github.com/b97tsk/async/releases/tag/v0.1.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.1.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.1.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.1.1/manifests"},{"name":"v0.1.0","sha":"d38489aedf8fb92550a917bd13d22b337fc8fbc6","kind":"commit","published_at":"2024-12-25T10:57:18.000Z","download_url":"https://codeload.github.com/b97tsk/async/tar.gz/v0.1.0","html_url":"https://github.com/b97tsk/async/releases/tag/v0.1.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/b97tsk/async@v0.1.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.1.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b97tsk%2Fasync/tags/v0.1.0/manifests"}]},"repo_metadata_updated_at":"2026-05-18T16:45:25.276Z","dependent_packages_count":0,"downloads":null,"downloads_period":null,"dependent_repos_count":0,"rankings":{"downloads":null,"dependent_repos_count":6.274472075463825,"dependent_packages_count":5.880194918849497,"stargazers_count":null,"forks_count":null,"docker_downloads_count":null,"average":6.077333497156661},"purl":"pkg:golang/github.com/b97tsk/async","advisories":[],"docker_usage_url":"https://docker.ecosyste.ms/usage/go/github.com/b97tsk/async","docker_dependents_count":null,"docker_downloads_count":null,"usage_url":"https://repos.ecosyste.ms/usage/go/github.com/b97tsk/async","dependent_repositories_url":"https://repos.ecosyste.ms/api/v1/usage/go/github.com/b97tsk/async/dependencies","status":null,"funding_links":[],"critical":null,"issue_metadata":null,"versions_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fb97tsk%2Fasync/versions","version_numbers_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fb97tsk%2Fasync/version_numbers","latest_version_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fb97tsk%2Fasync/latest_version","dependent_packages_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fb97tsk%2Fasync/dependent_packages","related_packages_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fb97tsk%2Fasync/related_packages","codemeta_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fb97tsk%2Fasync/codemeta","maintainers":[]}