summaryrefslogtreecommitdiff
path: root/src/cpu_mp.c
diff options
context:
space:
mode:
authorShell <[email protected]>2024-05-16 15:45:12 +0800
committerGitHub <[email protected]>2024-05-16 15:45:12 +0800
commite25fc8b5118fba87acd5bc677641926a913bb3a5 (patch)
treed86b1be0152b2d3f360c83a3922d945f565ecaf0 /src/cpu_mp.c
parente46333496f880afe7ae2864967406f758aec55a7 (diff)
[libcpu/arm64] add C11 atomic ticket spinlock (#8882)
* [libcpu/arm64] add C11 atomic ticket spinlock Replace the former implementation of flag-based spinlock which is unfair Besides, C11 atomic implementation is more readable (it's C anyway), and maintainable. Cause toolchain can use their builtin optimization and tune for different micro-architectures. For example armv8.5 introduces a better instruction. The compiler can help with that when it knows your target platform in support of it. Signed-off-by: Shell <[email protected]> * fixup: RT_CPUS_NR --------- Signed-off-by: Shell <[email protected]>
Diffstat (limited to 'src/cpu_mp.c')
-rw-r--r--src/cpu_mp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cpu_mp.c b/src/cpu_mp.c
index 238ddb420b..a10e35f479 100644
--- a/src/cpu_mp.c
+++ b/src/cpu_mp.c
@@ -146,7 +146,7 @@ rt_base_t rt_cpus_lock(void)
pcpu = rt_cpu_self();
if (pcpu->current_thread != RT_NULL)
{
- register rt_ubase_t lock_nest = rt_atomic_load(&(pcpu->current_thread->cpus_lock_nest));
+ rt_ubase_t lock_nest = rt_atomic_load(&(pcpu->current_thread->cpus_lock_nest));
rt_atomic_add(&(pcpu->current_thread->cpus_lock_nest), 1);
if (lock_nest == 0)