{"id":24517436,"url":"https://github.com/johannst/matcha-threads","last_synced_at":"2026-05-21T04:07:25.575Z","repository":{"id":132563773,"uuid":"296428783","full_name":"johannst/matcha-threads","owner":"johannst","description":"Cooperative multitasking for fun.","archived":false,"fork":false,"pushed_at":"2025-05-10T19:38:29.000Z","size":70,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-10T20:27:16.708Z","etag":null,"topics":["arm","arm64","armv7","asm","assembly","assembly-language","cooperative-multitasking","cooperative-thread","coroutines","corutine","cpp","fibers","riscv","riscv64","thread","threading","x64","x86","x86-64"],"latest_commit_sha":null,"homepage":"https://blog.memzero.de/xpost-matcha-threads","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/johannst.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":"2020-09-17T19:56:06.000Z","updated_at":"2025-05-10T19:38:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"8a736e38-8ee3-4a8d-9685-7185cd60f1bb","html_url":"https://github.com/johannst/matcha-threads","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/johannst/matcha-threads","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johannst%2Fmatcha-threads","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johannst%2Fmatcha-threads/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johannst%2Fmatcha-threads/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johannst%2Fmatcha-threads/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johannst","download_url":"https://codeload.github.com/johannst/matcha-threads/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johannst%2Fmatcha-threads/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33288206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T02:57:32.698Z","status":"ssl_error","status_checked_at":"2026-05-21T02:57:31.990Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["arm","arm64","armv7","asm","assembly","assembly-language","cooperative-multitasking","cooperative-thread","coroutines","corutine","cpp","fibers","riscv","riscv64","thread","threading","x64","x86","x86-64"],"created_at":"2025-01-22T01:33:58.195Z","updated_at":"2026-05-21T04:07:25.542Z","avatar_url":"https://github.com/johannst.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# matcha-threads\n[![check-examples][badge_check]][html_check] [![blog][badge_blog]][html_blog]\n\n\n\nA simple and unsafe implementation of `cooperative-multitasking` in userspace\n(see [`fibers`][fiber_wiki]).\n\nThis implementation should not be used for anything serious, it was just\ncreated to type some lines of `asm` and filll a few evenings.\n\nSupported platforms are `Linux` running on\n- `x86_64`\n- `arm64`\n- `armv7a`\n- `riscv64`\n\n### Example\n\n```cpp\n// file: demo.cc\n#include \"lib/executor.h\"\n#include \"lib/thread.h\"\n#include \u003ccstdio\u003e\n\nstruct MyThread : public nMatcha::Thread {\n    virtual void threadFn() override {\n        puts(\"like\");\n        yield();\n        puts(\"tea\");\n    }\n};\n\nint main() {\n    nMatcha::Executor e;\n    e.spawn(std::make_unique\u003cMyThread\u003e());\n    e.spawn(nMatcha::FnThread::make([](nMatcha::Yielder\u0026 y) {\n        puts(\"I\");\n        y.yield();\n        puts(\"green\");\n    }));\n    e.run();\n    return 0;\n}\n```\n\nThis example `demo.cc` can be run as\n```bash\n\u003e make -C lib \u0026\u0026 g++ -o demo demo.cc -I. lib/libmatcha.a \u0026\u0026 ./demo\n...\nI\nlike\ngreen\ntea\n```\n\n### Setup development environment\nThis project provides a [`Dockerfile`](docker/Dockerfile) with all the required\ntools pre-installed.\n\nTo build and launch a container instance run\n```bash\nmake docker\n```\n\u003e On the fist invocation this takes some minutes as it needs to build the\n\u003e docker image.\n\nAdditionally the locally cloned repository will be mounted into the container\ninstance. This allows to use editors/tools installed on the host and to reduce\nthe image disk footprint.\n\n### Build and run demo\nThe `x86_64` demo can be run as\n```bash\nmake demo1\n```\nThe `arm64` demo can be run as\n```bash\nmake ARCH=arm64 demo1\n```\nThe `armv7a` demo can be run as\n```bash\nmake ARCH=arm demo1\n```\nThe `riscv64` demo can be run as\n```bash\nmake ARCH=riscv64 demo1\n```\n\u003e Before starting to compile \u0026 run for a different architecture the the current\n\u003e build artifacts should be removed via `make clean`.\n\n## License\nThis project is licensed under the [MIT](LICENSE) license.\n\n[fiber_wiki]: https://en.wikipedia.org/wiki/Fiber_(computer_science)\n[html_check]: https://github.com/johannst/matcha-threads/actions/workflows/check.yml\n[badge_check]: https://github.com/johannst/matcha-threads/actions/workflows/check.yml/badge.svg\n[html_blog]: https://blog.memzero.de/xpost-matcha-threads\n[badge_blog]: https://img.shields.io/badge/blog_entry-gray?logo=mdbook\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohannst%2Fmatcha-threads","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohannst%2Fmatcha-threads","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohannst%2Fmatcha-threads/lists"}