diff options
author | Ewout van Bekkum <ewout@google.com> | 2021-04-08 15:40:24 -0700 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2021-04-12 17:15:57 +0000 |
commit | bc2af4d4279ffe6011ce96361fcaddf85764d927 (patch) | |
tree | b068e21533957c2930713a4946c30a89083c3ce3 | |
parent | cc9ef8367394c28f9a57fe0588d6fd9c3f8d0f87 (diff) | |
download | pigweed-bc2af4d4279ffe6011ce96361fcaddf85764d927.tar.gz |
pw_router: add lock safety annotations
No-Docs-Update-Reason: No functional change.
Change-Id: If5a3b06e831baedd1fbd952fedda31fe1ebe6662
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/40246
Pigweed-Auto-Submit: Ewout van Bekkum <ewout@google.com>
Commit-Queue: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
-rw-r--r-- | pw_router/BUILD.gn | 1 | ||||
-rw-r--r-- | pw_router/public/pw_router/static_router.h | 7 |
2 files changed, 5 insertions, 3 deletions
diff --git a/pw_router/BUILD.gn b/pw_router/BUILD.gn index a30eb7a8d..bcf934a9f 100644 --- a/pw_router/BUILD.gn +++ b/pw_router/BUILD.gn @@ -30,6 +30,7 @@ pw_source_set("static_router") { public_deps = [ ":egress", ":packet_parser", + "$dir_pw_sync:lock_annotations", "$dir_pw_sync:mutex", dir_pw_metric, ] diff --git a/pw_router/public/pw_router/static_router.h b/pw_router/public/pw_router/static_router.h index 66974565c..9c0925d5f 100644 --- a/pw_router/public/pw_router/static_router.h +++ b/pw_router/public/pw_router/static_router.h @@ -20,6 +20,7 @@ #include "pw_router/egress.h" #include "pw_router/packet_parser.h" #include "pw_status/status.h" +#include "pw_sync/lock_annotations.h" #include "pw_sync/mutex.h" namespace pw::router { @@ -62,11 +63,11 @@ class StaticRouter { // NOT_FOUND - No registered route for the packet. // UNAVAILABLE - Route egress did not accept packet. // - Status RoutePacket(ConstByteSpan packet); + Status RoutePacket(ConstByteSpan packet) PW_LOCKS_EXCLUDED(mutex_); private: - PacketParser& parser_; - std::span<const Route> routes_; + PacketParser& parser_ PW_GUARDED_BY(mutex_); + const std::span<const Route> routes_; sync::Mutex mutex_; PW_METRIC_GROUP(metrics_, "static_router"); PW_METRIC(metrics_, parser_errors_, "parser_errors", 0u); |