diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 075c20d..7ff0daa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -493,7 +493,7 @@ jobs: export PKG_CONFIG_PATH="$PWD/inst/lib/pkgconfig" pkg-config --exists protothread echo "version: $(pkg-config --modversion protothread)" - test "$(pkg-config --modversion protothread)" = "2.0.0" + test "$(pkg-config --modversion protothread)" = "2.1.0" printf '#include "protothread.h"\nint main(void){struct protothread_s s;protothread_init(&s);return protothread_run(&s);}\n' > use.c gcc $(pkg-config --cflags protothread) use.c -o use $(pkg-config --libs protothread) ./use diff --git a/CHANGELOG.md b/CHANGELOG.md index 98e7f86..3ffbfcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.1.0] - 2026-10-15 + ### Added - `pt_wait_until(c, channel, cond)`, which tests the predicate and enqueues in @@ -22,7 +24,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 before `pt_kill()`ing or freeing one that might be using the lock, as `pt_timer_cancel()` is for one that might be sleeping. Without it such a kill left the lock granted to a dead thread and never released. - - `protothread_queue.h`: message queues, what Go calls channels. A queue is a fixed-capacity ring buffer in storage the caller supplies, so it needs no allocator, and `PT_QUEUE_DEFINE(name, type)` makes it type-safe; `pt_queue_t` @@ -47,6 +48,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 the lock can tell a live request from a finished one. Internal, but it means a `pt_lock_env_t` must be zeroed or have been used with that lock before `pt_lock_cancel()` is called on it. +- The README's sections on semaphores, timers, locks, and queues moved to + their own pages under `doc/`, and the rest of the README was edited for + readability. ## [2.0.0] - 2026-09-22 @@ -170,4 +174,6 @@ There were no tagged releases before 2.0.0. The earlier code, which CMake and pkg-config reported as version 1.0 regardless of what changed, is referred to here as 1.x. +[Unreleased]: https://github.com/LarryRuane/protothread/compare/v2.1.0...HEAD +[2.1.0]: https://github.com/LarryRuane/protothread/releases/tag/v2.1.0 [2.0.0]: https://github.com/LarryRuane/protothread/releases/tag/v2.0.0 diff --git a/README.md b/README.md index c596b2d..6c67da7 100644 --- a/README.md +++ b/README.md @@ -697,10 +697,10 @@ This project uses [semantic versioning](https://semver.org). The version lives i ```c #define PT_VERSION_MAJOR 2 -#define PT_VERSION_MINOR 0 +#define PT_VERSION_MINOR 1 #define PT_VERSION_PATCH 0 -#define PT_VERSION_NUMBER /* ordered: 20000 */ -#define PT_VERSION_STRING /* "2.0.0", derived from the numbers */ +#define PT_VERSION_NUMBER /* ordered: 20100 */ +#define PT_VERSION_STRING /* "2.1.0", derived from the numbers */ #define PT_VERSION_AT_LEAST(major, minor, patch) ``` diff --git a/TODO.md b/TODO.md index ebd3e2f..3d80ac0 100644 --- a/TODO.md +++ b/TODO.md @@ -68,11 +68,9 @@ argument actually bites. ## More synchronization primitives ## -Timers are done (`protothread_timer.h`). Remaining, most useful first: +Timers (`protothread_timer.h`) and message queues (`protothread_queue.h`, in +2.1.0) are done. Remaining, most useful first: - * **Message queue.** The most-used RTOS primitive in practice, and it would - replace the hand-rolled single-slot mailbox in the README's own example. - Bounded ring over a caller-supplied buffer, blocking put/get, no allocation. * **Event flags.** Wait for any or all of a bit mask. Pairs well with interrupt handlers, and is the cheap workaround for the lack of multi-wait. * **Wait with timeout.** Needs the pattern the reader-writer lock already @@ -147,7 +145,7 @@ debugging into a one-line call, and costs nothing in a production build. * ~~Continuous integration~~ -- done, `.github/workflows/ci.yml`. Its first run found that the library did not build under clang at all. - * ~~Tag a release~~ -- done, `v2.0.0`. + * ~~Tag a release~~ -- done, `v2.0.0`, then `v2.1.0`. * ~~Document that `pt_wait`/`pt_signal` *is* a condition variable~~ -- done, the "Wait channels" section of README.md, which also makes the case for the interface: it is universal, and it degenerates to a busy-wait loop you can diff --git a/protothread.h b/protothread.h index aff43c1..aa0c53e 100644 --- a/protothread.h +++ b/protothread.h @@ -68,7 +68,7 @@ * #endif */ #define PT_VERSION_MAJOR 2 -#define PT_VERSION_MINOR 0 +#define PT_VERSION_MINOR 1 #define PT_VERSION_PATCH 0 #define PT_VERSION_NUMBER \