Skip to content

Commit

Permalink
irq: change this_task to current_task(me)
Browse files Browse the repository at this point in the history
reason:
this_task() is a function call that involves disabling interrupts and this_cpu(), since restore_critical_section is always called in an interrupt-disabled context, there's no need to disable interrupts again.
Therefore, to save time and achieve the same effect, I directly call tcb = current_task(me) instead of tcb = this_task().

Signed-off-by: hujun5 <[email protected]>
  • Loading branch information
hujun260 committed Jun 11, 2024
1 parent a5b9077 commit 42db4ac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sched/irq/irq_csection.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,13 +613,14 @@ void restore_critical_section(void)
* followed by context switching.
*/

FAR struct tcb_s *tcb = this_task();
FAR struct tcb_s *tcb;
int me = this_cpu();

/* Adjust global IRQ controls. If irqcount is greater than zero,
* then this task/this CPU holds the IRQ lock
*/

tcb = current_task(me);
if (tcb->irqcount > 0)
{
/* Do notihing here
Expand Down

0 comments on commit 42db4ac

Please sign in to comment.