Releases: DefectingCat/coco
Releases · DefectingCat/coco
v2.2.0
Added
- Runtime version query API:
coco_version(),coco_version_major(),coco_version_minor(),coco_version_patch(). ENSURE_IN_CORO/ENSURE_IN_CORO_RET/ENSURE_IN_CORO_VOIDguard macros for coroutine-only APIs, preventing crashes when called outside a coroutine context.- POSIX signal block/unblock (
coco_preempt_block_signal()/coco_preempt_unblock_signal()) with reference-counted nesting counter for critical section protection. - P binding detection for
coco_go(): when called from a worker thread, the new coroutine binds to the current P instead of scanning all processors. - Periodic load balancing integrated into the worker loop (triggered every 100 coroutines processed).
- Linux netpoller wakeup uses
eventfdinstead of pipe for lower overhead. - New examples:
hot_stack,dynamic_stack,context_api. - New benchmarks:
bench_mt_sched,bench_hot_cold_switch;bench_iorewritten to measure actual coroutine I/O throughput. - New tests:
stress_mt_scaling,stress_channel_mt_burst,test_ctx_x86_64,test_preempt_block,test_preempt_channel,test_preempt_sched,test_coro_guard,test_sched_reinit,test_sched_balanced. - Doxygen configuration for API reference generation.
- GitHub Actions CI workflow with sanitizer matrix (ASan, UBSan).
- Automated release workflow triggered on version tag push.
Changed
coco_yield()return type changed fromvoidtoint(returnsCOCO_ERROR_INVALIDwhen called outside a coroutine). ABI note: existing compiled objects must be recompiled.coro->statetype changed fromint(non-atomic) to_Atomic intfor thread-safety. ABI note: existing compiled objects must be recompiled.- Global runq wake strategy: targeted
pthread_cond_signalreplaces broadcast to fix thundering herd.
Fixed
- Multi-threaded scheduler data races and leaks:
coro->stateis now_Atomic(acquire/release ordering).stack_pool_multiprotected by per-pool mutex.- Wrong-pool-free on work-stealing fixed via
coro->stack_pooltracking.
- Channel
wait_queue_lockand schedulerglobal_runq_lock/local_runq_lockcritical sections protected from preemption. - Scheduler reinitialization:
coco_global_sched_stop()now fully cleans up state (queues, counters, locks). schedule_balanced()now actually redistributes coroutines from overloaded P's and releases hot-stack slots before migration.- Worker thread H2 path now performs load balancing (extracted shared
handle_coro_donehelper). - Windows APC preemption delivery: added alertable
SleepExin idle paths. - Windows worker idle sleep capped to 1ms to prevent lost
pthread_cond_signalwakeups. - Windows I/O function linker conflicts between POSIX and Winsock implementations resolved.
- UBSan null-pointer in
stress_channel_burst: hot-stack backup/restore now rewrites stack pointers in callee-saved registers. - GCC 16 rbp clobber in sanitizer builds (
-fomit-frame-pointerfor register integrity test). - Signal blocking nesting counter underflow guard in
coco_preempt_unblock_signal(). - Munmap fallback in
coco_global_sched_stop()queue cleanup whencoro->stack_poolis NULL.
v2.1.0
Fixed
- Memory leak when coroutine IDs exceed
coro_tablecapacity (dynamicreallocexpansion) - Memory leak in MT worker: dead coroutines not freed after execution
- Memory leak in
stress_channel_bursttest: channels not destroyed on teardown - Memory leak in
coco_sched_destroy: select state and non-pool stacks not cleaned up - io_uring test crash under AddressSanitizer (skipped due to mmap ring buffer incompatibility with ASAN)
Added
cmake --installsupport for headers and static library (GNUInstallDirs)- Shared stack support with work-stealing migration hook
- Stack growth benchmarks and stress tests