{"id":35556638,"url":"https://github.com/ghevondw/cortex","last_synced_at":"2026-02-01T09:01:25.273Z","repository":{"id":333270457,"uuid":"1124112665","full_name":"GhevondW/cortex","owner":"GhevondW","description":"C++ stackful coroutine library with native and WebAssembly support","archived":false,"fork":false,"pushed_at":"2026-01-31T20:32:11.000Z","size":157,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-01T04:18:34.591Z","etag":null,"topics":["async","concurrency","coroutines","cpp","emscripten","library","wasm","webassembly"],"latest_commit_sha":null,"homepage":"","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/GhevondW.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":"2025-12-28T11:10:25.000Z","updated_at":"2026-01-31T20:12:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/GhevondW/cortex","commit_stats":null,"previous_names":["ghevondw/cortex"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/GhevondW/cortex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GhevondW%2Fcortex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GhevondW%2Fcortex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GhevondW%2Fcortex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GhevondW%2Fcortex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GhevondW","download_url":"https://codeload.github.com/GhevondW/cortex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GhevondW%2Fcortex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28974246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T08:16:14.655Z","status":"ssl_error","status_checked_at":"2026-02-01T08:06:51.373Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["async","concurrency","coroutines","cpp","emscripten","library","wasm","webassembly"],"created_at":"2026-01-04T09:14:31.032Z","updated_at":"2026-02-01T09:01:25.268Z","avatar_url":"https://github.com/GhevondW.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cortex\n\nA C++ stackful coroutine library with WebAssembly support, featuring cooperative multitasking primitives.\n\n## Features\n\n- **Stackful Coroutines** - Full coroutine support with suspend/resume\n- **tiny_fiber Module** - Cooperative multitasking scheduler with:\n  - `Scheduler` - Fiber management with step-based API for WASM\n  - `Future\u003cT\u003e` - Async result handling\n  - `Mutex` / `ConditionVariable` - Cooperative synchronization (no OS threads!)\n  - `Yield()` - Explicit context switching\n- **WebAssembly Support** - Runs in browsers via Emscripten\n- **Cross-Platform** - Native (Linux/macOS) and WASM from single codebase\n\n## Live Demo\n\nTry the interactive WASM examples in your browser (no installation required):\n\n[![Live Demo](https://img.shields.io/badge/demo-live-brightgreen?style=for-the-badge)](https://GhevondW.github.io/cortex/)\n[![Docs](https://img.shields.io/badge/docs-doxygen-blue?style=for-the-badge)](https://GhevondW.github.io/cortex/docs/)\n\n- **[All Examples](https://GhevondW.github.io/cortex/)** - Browse all demos\n- **[Fiber Workflow](https://GhevondW.github.io/cortex/examples/fiber_demo.html)** - Cooperative multitasking demo (New!)\n- **[Sudoku Solver](https://GhevondW.github.io/cortex/examples/sudoku_demo.html)** - Recursive backtracking visualization (Must See!)\n- **[Particle Simulation](https://GhevondW.github.io/cortex/examples/particle_demo.html)** - See coroutines in action! (Recommended)\n- **[Basic Example](https://GhevondW.github.io/cortex/examples/index.html)** - Simple suspend/resume demo\n- **[API Docs](https://GhevondW.github.io/cortex/docs/)** - Doxygen-generated documentation\n\n## Quick Example\n\n```cpp\n#include \u003ccortex/tiny_fiber/tiny_fiber.hpp\u003e\nnamespace tf = cortex::tiny_fiber;\n\nint main() {\n    tf::Scheduler::Run([] {\n        // Spawn a fiber that returns a value\n        auto future = tf::Spawn([] {\n            tf::Yield();  // Cooperative yield\n            return 42;\n        });\n        \n        // Do other work while fiber runs\n        tf::Yield();\n        \n        // Get result (blocks until fiber completes)\n        int result = future.Get();\n    });\n}\n```\n\nFor WASM integration with JS event loop:\n```cpp\nauto scheduler = tf::Scheduler::Create([]{\n    // Your fiber code\n});\n\n// Called from JS via setInterval\nwhile (!scheduler.IsDone()) {\n    scheduler.Step();  // Run one fiber until yield\n}\n```\n\n## Quick Start\n\n### Prerequisites\n\n- Docker\n- Docker Compose\n\n### Using the Helper Script\n\n```bash\n./dev.sh test-all        # Run all tests\n./dev.sh test-native     # Run native tests\n./dev.sh test-wasm       # Run WASM tests\n./dev.sh serve           # Serve WASM example in browser\n./dev.sh help            # Show all commands\n```\n\n### Manual Commands\n\n**Run Native Tests:**\n```bash\ndocker compose up --build test-native\n```\n\n**Run WASM Tests:**\n```bash\ndocker compose up --build test-wasm\n```\n\n### Run Examples\n\n**Online (No Installation Required):**\n\nTry the **[live demo](https://GhevondW.github.io/cortex/)** in your browser!\n\n**Native (Local):**\n```bash\ndocker compose up --build build-example-native\n```\n\n**WASM (Local Browser):**\n```bash\ndocker compose up serve-example\n# Open http://localhost:8080/examples/examples_index.html (all examples)\n# Or http://localhost:8080/examples/sudoku_demo.html (sudoku solver - must see!)\n# Or http://localhost:8080/examples/particle_demo.html (recommended interactive demo)\n# Or http://localhost:8080/examples/index.html (basic example)\n```\n\n## Development\n\nFor detailed development instructions, see [DEVELOPMENT.md](DEVELOPMENT.md).\n\n### IDE Setup\n\nThe project includes configurations for:\n- **VSCode**: `.devcontainer/` for container development, `.vscode/` for tasks and settings\n- **CLion**: Docker toolchain setup instructions in [DEVELOPMENT.md](DEVELOPMENT.md)\n\nQuick start with VSCode:\n1. Install \"Remote - Containers\" extension\n2. Open project in VSCode\n3. Click \"Reopen in Container\" when prompted\n4. Start coding with full IntelliSense inside Docker!\n\n## Building\n\n### Native Build\n\n```bash\ncmake -B build/native -DCORTEX_BUILD_TESTS=ON\ncmake --build build/native\nctest --test-dir build/native\n```\n\n### WASM Build\n\n```bash\nsource /path/to/emsdk/emsdk_env.sh\nemcmake cmake -B build/wasm -G Ninja -DCORTEX_BUILD_TESTS=ON\ncmake --build build/wasm\nctest --test-dir build/wasm\n```\n\n## Testing\n\nBoth native and WASM builds include comprehensive test suites:\n\n- **Native Tests**: Run with GoogleTest on Linux/macOS\n- **WASM Tests**: Run with GoogleTest in Node.js\n\nAll tests must pass on both platforms before merging changes.\n\n## Requirements\n\n### Docker (Recommended)\n- Docker\n- Docker Compose\n\n### Local Development\n- CMake 3.25+\n- C++23 compiler (Clang 19+ or GCC 13+)\n- Ninja build system\n- Emscripten SDK (for WASM)\n- Node.js 18+ (for WASM tests)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghevondw%2Fcortex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghevondw%2Fcortex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghevondw%2Fcortex/lists"}