syslog: Change g_syslog_default_sem to static function variable
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
49b15e3577
commit
8391ad2721
|
@ -115,10 +115,6 @@ static struct syslog_channel_s g_rtt_channel =
|
|||
#endif
|
||||
|
||||
#if defined(CONFIG_SYSLOG_DEFAULT)
|
||||
# if defined(CONFIG_ARCH_LOWPUTC)
|
||||
static sem_t g_syslog_default_sem = SEM_INITIALIZER(1);
|
||||
# endif
|
||||
|
||||
static const struct syslog_channel_ops_s g_default_channel_ops =
|
||||
{
|
||||
syslog_default_putc,
|
||||
|
@ -184,15 +180,16 @@ static ssize_t syslog_default_write(FAR struct syslog_channel_s *channel,
|
|||
FAR const char *buffer, size_t buflen)
|
||||
{
|
||||
#if defined(CONFIG_ARCH_LOWPUTC)
|
||||
static sem_t sem = SEM_INITIALIZER(1);
|
||||
size_t nwritten;
|
||||
|
||||
nxsem_wait(&g_syslog_default_sem);
|
||||
nxsem_wait(&sem);
|
||||
for (nwritten = 0; nwritten < buflen; nwritten++)
|
||||
{
|
||||
up_putc(buffer[nwritten]);
|
||||
}
|
||||
|
||||
nxsem_post(&g_syslog_default_sem);
|
||||
nxsem_post(&sem);
|
||||
#endif
|
||||
|
||||
return buflen;
|
||||
|
|
Loading…
Reference in New Issue