| commit | 49eaa58b25ea1a68dae433cc8f29a3c1ee48e680 | [log] [tgz] |
|---|---|---|
| author | Austin Foxley <afoxley@google.com> | Mon Apr 28 15:37:14 2025 -0700 |
| committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Mon Apr 28 15:37:14 2025 -0700 |
| tree | 8efcc23f0a4b7cb3c0c83a7aae7e75b313b9c462 | |
| parent | 78f9a92d9bf1eac9f7bb071dc013098f5b2b8e8d [diff] |
pw_thread: Introduce ThreadChecker ThreadChecker is a BaseLockable class that stores the id of a thread and verifies that all `lock()` calls happen on that thread if the `PW_THREAD_CHECKER_RUNTIME_ASSERT_ENABLED` config option is set. Its purpose is to provide a check that data that is meant to only be accessed from a single thread is always accessed from that thread. This is useful on data that isn't synchronized using regular sync primitives. For example, this could be used on data that is always run on an async dispatcher to ensure all data access happens on that dispatcher thread. In addition to providing an optional runtime check, this class can be used with static thread safety analysis to ensure that resources are accessed in a context that is checked. Change-Id: Ia7b1f4b1e8f9fbe41dd6eaade730c5f1f137c4c4 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/282938 Reviewed-by: Carlos Chinchilla <cachinchilla@google.com> Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com> Tests-Not-Needed: Austin Foxley <afoxley@google.com> Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com> Pigweed-Auto-Submit: Austin Foxley <afoxley@google.com> Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.
For more information please see our website: https://pigweed.dev/.