{"id":25006636,"url":"https://github.com/markandre13/async.cc","last_synced_at":"2025-07-25T01:10:19.354Z","repository":{"id":222021806,"uuid":"756030321","full_name":"markandre13/async.cc","owner":"markandre13","description":"lightweight c++20 coroutine task class","archived":false,"fork":false,"pushed_at":"2025-01-01T12:39:59.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-05T01:51:13.856Z","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/markandre13.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-02-11T19:24:03.000Z","updated_at":"2025-01-01T12:40:03.000Z","dependencies_parsed_at":"2024-02-11T21:14:13.502Z","dependency_job_id":"ec11af8b-b9e9-4ebd-9bbb-81e2b244021b","html_url":"https://github.com/markandre13/async.cc","commit_stats":null,"previous_names":["markandre13/cpptask"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markandre13%2Fasync.cc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markandre13%2Fasync.cc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markandre13%2Fasync.cc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markandre13%2Fasync.cc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markandre13","download_url":"https://codeload.github.com/markandre13/async.cc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246258868,"owners_count":20748573,"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","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":"2025-02-05T01:50:27.480Z","updated_at":"2025-03-30T00:16:29.248Z","avatar_url":"https://github.com/markandre13.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# async.cc\n\na lightweight c++20 coroutine task class\n\n\u003e  \"you can have peace. or you can have freedom. don't ever count on having both at once.\"\n\u003e  -- robert a. heinlein\n\nwhile c++20/23 coroutines provide a lot of freedom to accommodate many different use cases and hardware platforms, actually _using_ them does not provide much peace of mind.\n\na lot of examples on the web do use a class named 'task' along with coroutines, but it's actually not part of the c++ standard.\n\nthis file contains a variation of cppcoro's 'task' class called 'async' and tweaks it to be usable without the rest of the cppcoro library.\n\n ### class async\n\n_async_ is the class to be returned from coroutines.\n\nit is basically a copy of https://github.com/andreasbuhr/cppcoro's task with two changes:\n\n* while one can call a coroutine from other coroutines like this\n  ```c++\n  async\u003c\u003e fun0() {\n    co_await fun1();\n  }\n  ```\n  one can also call a coroutine from synchronous code\n  ```c++\n  int fun0() {\n    fun1().no_wait();\n  }\n  ```\n  with no_wait() preventing the coroutine's state from being deleted along with the task in case it is still running and instead deleted it once it's finished.\n \n * the coroutine is immediately executed.\n\n ### class interlock\n\n _interlock\u003cKEY, VALUE\u003e_ is the class to be used to suspend and resume coroutines:\n\n```c++\nauto value = co_await interlock.suspend(key);\n```\n\nwill suspend the execution of the coroutine until\n\n```c++\ninterlock.resume(key, value);\n```\n\nresumes it along with providing a value.\n\n### TODO\n\n- [x] for the full 'javascript' experience, add then() and catch() variants to 'async'\n- [ ] try to move the 'return !m_coroutine.done();' from awaitable_base from\n     await_suspend() into await_ready() to improve performance.\n- [ ] test exception handling\n- [ ] async\u003cT\u0026\u003e not yet included in tests\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkandre13%2Fasync.cc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkandre13%2Fasync.cc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkandre13%2Fasync.cc/lists"}