TaiJuWu opened a new issue, #10981: URL: https://github.com/apache/nuttx/issues/10981
I have three questions about enter_critical_section. First. When I wrote spinlock code, I found spinlock_irqsave can disable interrupt. Why we need to use enter_critical_section in [mm_alloc](https://github.com/apache/nuttx/blob/a521fd7b82dec43871b4f56a6ae0d85d124158e9/mm/mm_heap/mm_malloc.c#L50) instead of spinlock_irqsave? The operation is very light. And I have read https://github.com/apache/nuttx/issues/2213#issuecomment-731052528, enter_critical_section may make caller sleep and cause delay. Second. And there is a [archive](https://www.mail-archive.com/dev@nuttx.apache.org/msg04078.html) describe `the critical section is left automatically when the context switch occurs` but I can't find any code about this description. Three. The critical section is in oder to resolving some architecture can't disable global interrupt. But why other RTOS projects don't have this feature? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org