Revert "arch: deprecate `_current`"
Mostly a revert of commit b1def7145fd1 ("arch: deprecate `_current`").
This commit was part of PR #80716 whose initial purpose was about providing
an architecture specific optimization for _current. The actual deprecation
was sneaked in later on without proper discussion.
The Zephyr core always used _current before and that was fine. It is quite
prevalent as well and the alternative is proving rather verbose.
Furthermore, as a concept, the "current thread" is not something that is
necessarily architecture specific. Therefore the primary abstraction
should not carry the arch_ prefix.
Hence this revert.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
diff --git a/kernel/smp.c b/kernel/smp.c
index b0eefb3..a565952 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -58,23 +58,23 @@
{
unsigned int key = arch_irq_lock();
- if (!arch_current_thread()->base.global_lock_count) {
+ if (!_current->base.global_lock_count) {
while (!atomic_cas(&global_lock, 0, 1)) {
arch_spin_relax();
}
}
- arch_current_thread()->base.global_lock_count++;
+ _current->base.global_lock_count++;
return key;
}
void z_smp_global_unlock(unsigned int key)
{
- if (arch_current_thread()->base.global_lock_count != 0U) {
- arch_current_thread()->base.global_lock_count--;
+ if (_current->base.global_lock_count != 0U) {
+ _current->base.global_lock_count--;
- if (!arch_current_thread()->base.global_lock_count) {
+ if (!_current->base.global_lock_count) {
(void)atomic_clear(&global_lock);
}
}