Skip to content

Commit

Permalink
sched_lock: we can remove these sched_lock,
Browse files Browse the repository at this point in the history
There is no context switching in the protected area

Change-Id: I6c89af077f53ed8a78ad73258a8d0b61f5420797
  • Loading branch information
hujun260 committed Apr 14, 2024
1 parent 3ce84d1 commit d2cb69b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 3 additions & 2 deletions drivers/syslog/syslog_intbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,15 @@ int syslog_add_intbuffer(int ch)
int syslog_flush_intbuffer(bool force)
{
syslog_putc_t putfunc;
irqstate_t flags;
int ch;
int i;

/* This logic is performed with the scheduler disabled to protect from
* concurrent modification by other tasks.
*/

sched_lock();
flags = enter_critical_section();

do
{
Expand Down Expand Up @@ -293,7 +294,7 @@ int syslog_flush_intbuffer(bool force)
}
while (ch != EOF);

sched_unlock();
leave_critical_section(flags);

return ch;
}
Expand Down
4 changes: 0 additions & 4 deletions sched/misc/assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,6 @@ void _assert(FAR const char *filename, int linenum,

flags = enter_critical_section();

sched_lock();

/* try to save current context if regs is null */

if (regs == NULL)
Expand Down Expand Up @@ -672,7 +670,5 @@ void _assert(FAR const char *filename, int linenum,
#endif
}

sched_unlock();

leave_critical_section(flags);
}

0 comments on commit d2cb69b

Please sign in to comment.