Skip to content

Commit af702e0

Browse files
committed
[ulog] Optimize code to improve readability.
1 parent 615824b commit af702e0

File tree

1 file changed

+2
-2
lines changed
  • components/utilities/ulog

1 file changed

+2
-2
lines changed

components/utilities/ulog/ulog.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static void output_unlock(void)
191191
return;
192192

193193
/* If the scheduler is started and in thread context */
194-
if (rt_thread_self() && (rt_interrupt_get_nest() == 0))
194+
if (rt_interrupt_get_nest() == 0 && rt_thread_self() != RT_NULL)
195195
{
196196
rt_sem_release(&ulog.output_locker);
197197
}
@@ -209,7 +209,7 @@ static void output_lock(void)
209209
return;
210210

211211
/* If the scheduler is started and in thread context */
212-
if (rt_thread_self() && (rt_interrupt_get_nest() == 0))
212+
if (rt_interrupt_get_nest() == 0 && rt_thread_self() != RT_NULL)
213213
{
214214
rt_sem_take(&ulog.output_locker, RT_WAITING_FOREVER);
215215
}

0 commit comments

Comments
 (0)