pw_sync: rename SpinLock -> InterruptSpinLock
Renames the existing pw::sync::SpinLock to InterruptSpinLock to
make it obvious that this is not just a spin lock and that interrupt
masking is included.
This change leaves C++ & GN redirects in place in order to support
migrating Pigweed and customers in follow up changes.
Change-Id: If9fb5594e7d71778b15cd15a9cd7ec71ca0e403b
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/37560
Commit-Queue: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
diff --git a/pw_sync/BUILD.gn b/pw_sync/BUILD.gn
index 615c3db..583f6ea 100644
--- a/pw_sync/BUILD.gn
+++ b/pw_sync/BUILD.gn
@@ -58,12 +58,24 @@
sources = [ "mutex.cc" ]
}
-pw_facade("spin_lock") {
- backend = pw_sync_SPIN_LOCK_BACKEND
- public_configs = [ ":public_include_path" ]
+# TODO(ewout): Finish the migration and remove this logic.
+if (pw_sync_SPIN_LOCK_BACKEND != "") {
+ assert(pw_sync_INTERRUPT_SPIN_LOCK_BACKEND == "",
+ "You cannot define the backend for pw::sync::InterruptSpinLock twice!")
+ pw_sync_INTERRUPT_SPIN_LOCK_BACKEND = pw_sync_SPIN_LOCK_BACKEND
+}
+
+pw_source_set("spin_lock") {
+ public_deps = [ ":interrupt_spin_lock" ]
public = [ "public/pw_sync/spin_lock.h" ]
+}
+
+pw_facade("interrupt_spin_lock") {
+ backend = pw_sync_INTERRUPT_SPIN_LOCK_BACKEND
+ public_configs = [ ":public_include_path" ]
+ public = [ "public/pw_sync/interrupt_spin_lock.h" ]
public_deps = [ "$dir_pw_preprocessor" ]
- sources = [ "spin_lock.cc" ]
+ sources = [ "interrupt_spin_lock.cc" ]
}
pw_source_set("yield_core") {
@@ -76,7 +88,7 @@
":binary_semaphore_facade_test",
":counting_semaphore_facade_test",
":mutex_facade_test",
- ":spin_lock_facade_test",
+ ":interrupt_spin_lock_facade_test",
]
}
@@ -119,16 +131,16 @@
]
}
-pw_test("spin_lock_facade_test") {
- enable_if = pw_sync_SPIN_LOCK_BACKEND != ""
+pw_test("interrupt_spin_lock_facade_test") {
+ enable_if = pw_sync_INTERRUPT_SPIN_LOCK_BACKEND != ""
sources = [
- "spin_lock_facade_test.cc",
- "spin_lock_facade_test_c.c",
+ "interrupt_spin_lock_facade_test.cc",
+ "interrupt_spin_lock_facade_test_c.c",
]
deps = [
- ":spin_lock",
+ ":interrupt_spin_lock",
"$dir_pw_preprocessor",
- pw_sync_SPIN_LOCK_BACKEND,
+ pw_sync_INTERRUPT_SPIN_LOCK_BACKEND,
]
}