summaryrefslogtreecommitdiff
path: root/src/timer.c
diff options
context:
space:
mode:
authorShell <[email protected]>2024-05-08 09:22:09 +0800
committerGitHub <[email protected]>2024-05-08 09:22:09 +0800
commit6977cf91013724b8bf632cf4ad08f8dbb0392fb2 (patch)
tree00bb4f5b9bf00714b8176db4fced2e09e096d6f5 /src/timer.c
parent02e0334ac3dacca463c36bcbb7f71b0f35c2af85 (diff)
[src] add rt_hw_cpu_id() wrapper API (#8894)
* [src] add rt_hw_cpu_id() wrapper API rt_hw_cpu_id() is an unsafe API which should not be used by most codes directly. It's error-prone because it must be used in proper context, otherwise it can lead to errors and unpredictable behavior. This patch adds a wrapper API for rt_hw_cpu_id() to address this risk. It includes the context-checking functionality and provides a safer alternative for obtaining CPU IDs, ensuring that it is used correctly within the appropriate context. Signed-off-by: Shell <[email protected]> * fixup UMP * update API & comment * ci: cpp_check --------- Signed-off-by: Shell <[email protected]>
Diffstat (limited to 'src/timer.c')
-rw-r--r--src/timer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/timer.c b/src/timer.c
index 4d7b352d60..143bbebb12 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -684,7 +684,7 @@ void rt_timer_check(void)
#ifdef RT_USING_SMP
/* Running on core 0 only */
- if (rt_hw_cpu_id() != 0)
+ if (rt_cpu_get_id() != 0)
{
rt_spin_unlock_irqrestore(&_htimer_lock, level);
return;