mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-22 02:55:20 +08:00
[ulog] Fixed the problem of abnormal log output at the INIT_BOARD_EXPORT level.
This commit is contained in:
parent
23c1fdd779
commit
26c511475e
@ -190,8 +190,8 @@ static void output_unlock(void)
|
|||||||
if (!ulog.output_lock_enabled)
|
if (!ulog.output_lock_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* is in thread context */
|
/* If the scheduler is started and in thread context */
|
||||||
if (rt_interrupt_get_nest() == 0)
|
if (rt_thread_self() && (rt_interrupt_get_nest() == 0))
|
||||||
{
|
{
|
||||||
rt_sem_release(&ulog.output_locker);
|
rt_sem_release(&ulog.output_locker);
|
||||||
}
|
}
|
||||||
@ -208,8 +208,8 @@ static void output_lock(void)
|
|||||||
if (!ulog.output_lock_enabled)
|
if (!ulog.output_lock_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* is in thread context */
|
/* If the scheduler is started and in thread context */
|
||||||
if (rt_interrupt_get_nest() == 0)
|
if (rt_thread_self() && (rt_interrupt_get_nest() == 0))
|
||||||
{
|
{
|
||||||
rt_sem_take(&ulog.output_locker, RT_WAITING_FOREVER);
|
rt_sem_take(&ulog.output_locker, RT_WAITING_FOREVER);
|
||||||
}
|
}
|
||||||
@ -429,6 +429,13 @@ void ulog_output_to_all_backend(rt_uint32_t level, const char *tag, rt_bool_t is
|
|||||||
if (!ulog.init_ok)
|
if (!ulog.init_ok)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* if there is no backend */
|
||||||
|
if (!rt_slist_first(&ulog.backend_list))
|
||||||
|
{
|
||||||
|
rt_kputs(log);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* output for all backends */
|
/* output for all backends */
|
||||||
for (node = rt_slist_first(&ulog.backend_list); node; node = rt_slist_next(node))
|
for (node = rt_slist_first(&ulog.backend_list); node; node = rt_slist_next(node))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user