tag:github.com,2008:https://github.com/DefectingCat/coco/releases Release notes from coco 2026-06-04T10:25:50Z tag:github.com,2008:Repository/1223073071/v2.2.0 2026-06-04T10:26:20Z v2.2.0 <h3>Added</h3> <ul> <li>Runtime version query API: <code>coco_version()</code>, <code>coco_version_major()</code>, <code>coco_version_minor()</code>, <code>coco_version_patch()</code>.</li> <li><code>ENSURE_IN_CORO</code> / <code>ENSURE_IN_CORO_RET</code> / <code>ENSURE_IN_CORO_VOID</code> guard macros for coroutine-only APIs, preventing crashes when called outside a coroutine context.</li> <li>POSIX signal block/unblock (<code>coco_preempt_block_signal()</code> / <code>coco_preempt_unblock_signal()</code>) with reference-counted nesting counter for critical section protection.</li> <li>P binding detection for <code>coco_go()</code>: when called from a worker thread, the new coroutine binds to the current P instead of scanning all processors.</li> <li>Periodic load balancing integrated into the worker loop (triggered every 100 coroutines processed).</li> <li>Linux netpoller wakeup uses <code>eventfd</code> instead of pipe for lower overhead.</li> <li>New examples: <code>hot_stack</code>, <code>dynamic_stack</code>, <code>context_api</code>.</li> <li>New benchmarks: <code>bench_mt_sched</code>, <code>bench_hot_cold_switch</code>; <code>bench_io</code> rewritten to measure actual coroutine I/O throughput.</li> <li>New tests: <code>stress_mt_scaling</code>, <code>stress_channel_mt_burst</code>, <code>test_ctx_x86_64</code>, <code>test_preempt_block</code>, <code>test_preempt_channel</code>, <code>test_preempt_sched</code>, <code>test_coro_guard</code>, <code>test_sched_reinit</code>, <code>test_sched_balanced</code>.</li> <li>Doxygen configuration for API reference generation.</li> <li>GitHub Actions CI workflow with sanitizer matrix (ASan, UBSan).</li> <li>Automated release workflow triggered on version tag push.</li> </ul> <h3>Changed</h3> <ul> <li><code>coco_yield()</code> return type changed from <code>void</code> to <code>int</code> (returns <code>COCO_ERROR_INVALID</code> when called outside a coroutine). <strong>ABI note:</strong> existing compiled objects must be recompiled.</li> <li><code>coro-&gt;state</code> type changed from <code>int</code> (non-atomic) to <code>_Atomic int</code> for thread-safety. <strong>ABI note:</strong> existing compiled objects must be recompiled.</li> <li>Global runq wake strategy: targeted <code>pthread_cond_signal</code> replaces broadcast to fix thundering herd.</li> </ul> <h3>Fixed</h3> <ul> <li>Multi-threaded scheduler data races and leaks: <ul> <li><code>coro-&gt;state</code> is now <code>_Atomic</code> (acquire/release ordering).</li> <li><code>stack_pool_multi</code> protected by per-pool mutex.</li> <li>Wrong-pool-free on work-stealing fixed via <code>coro-&gt;stack_pool</code> tracking.</li> </ul> </li> <li>Channel <code>wait_queue_lock</code> and scheduler <code>global_runq_lock</code> / <code>local_runq_lock</code> critical sections protected from preemption.</li> <li>Scheduler reinitialization: <code>coco_global_sched_stop()</code> now fully cleans up state (queues, counters, locks).</li> <li><code>schedule_balanced()</code> now actually redistributes coroutines from overloaded P's and releases hot-stack slots before migration.</li> <li>Worker thread H2 path now performs load balancing (extracted shared <code>handle_coro_done</code> helper).</li> <li>Windows APC preemption delivery: added alertable <code>SleepEx</code> in idle paths.</li> <li>Windows worker idle sleep capped to 1ms to prevent lost <code>pthread_cond_signal</code> wakeups.</li> <li>Windows I/O function linker conflicts between POSIX and Winsock implementations resolved.</li> <li>UBSan null-pointer in <code>stress_channel_burst</code>: hot-stack backup/restore now rewrites stack pointers in callee-saved registers.</li> <li>GCC 16 rbp clobber in sanitizer builds (<code>-fomit-frame-pointer</code> for register integrity test).</li> <li>Signal blocking nesting counter underflow guard in <code>coco_preempt_unblock_signal()</code>.</li> <li>Munmap fallback in <code>coco_global_sched_stop()</code> queue cleanup when <code>coro-&gt;stack_pool</code> is NULL.</li> </ul> DefectingCat tag:github.com,2008:Repository/1223073071/v2.1.0 2026-06-03T16:01:57Z v2.1.0 <h3>Fixed</h3> <ul> <li>Memory leak when coroutine IDs exceed <code>coro_table</code> capacity (dynamic <code>realloc</code> expansion)</li> <li>Memory leak in MT worker: dead coroutines not freed after execution</li> <li>Memory leak in <code>stress_channel_burst</code> test: channels not destroyed on teardown</li> <li>Memory leak in <code>coco_sched_destroy</code>: select state and non-pool stacks not cleaned up</li> <li>io_uring test crash under AddressSanitizer (skipped due to mmap ring buffer incompatibility with ASAN)</li> </ul> <h3>Added</h3> <ul> <li><code>cmake --install</code> support for headers and static library (GNUInstallDirs)</li> <li>Shared stack support with work-stealing migration hook</li> <li>Stack growth benchmarks and stress tests</li> </ul> DefectingCat tag:github.com,2008:Repository/1223073071/v2.0.0 2026-05-09T03:44:15Z v2.0.0 <p>Release v2.0.0: multi-threaded scheduler, dynamic stack growth, preem…</p> DefectingCat tag:github.com,2008:Repository/1223073071/v1.0.0 2026-04-28T05:53:44Z v1.0.0 <p>Release v1.0.0 - Initial release with stackful coroutines, channels, …</p> DefectingCat