mirror of
https://github.com/apache/nuttx.git
synced 2026-05-25 09:45:55 +08:00
sched/addrenv: replace critical section with spinlock for refs protection
Build Documentation / build-html (push) Has been cancelled
Build Documentation / build-html (push) Has been cancelled
Replace global enter_critical_section() calls with lightweight spinlock in addrenv_switch() to reduce interrupt latency, and convert refs counter to atomic_t for thread-safe reference counting without blocking operations. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/atomic.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
|
||||
#include <arch/arch.h>
|
||||
@@ -264,7 +265,7 @@ struct addrenv_s
|
||||
{
|
||||
struct arch_addrenv_s addrenv; /* The address environment page directory */
|
||||
struct work_s work; /* Worker to free address environment */
|
||||
int refs; /* Users of address environment */
|
||||
atomic_t refs; /* Users of address environment */
|
||||
};
|
||||
|
||||
typedef struct addrenv_s addrenv_t;
|
||||
|
||||
Reference in New Issue
Block a user