This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 46baccb  Remove unnecessary enter/leave_critical_section() in 
setlogmask() because it is MT-unsafe.
46baccb is described below

commit 46baccb5212660fb671c069bbd569bf56ff47e56
Author: Nakamura, Yuuichi <yuuichi.a.nakam...@sony.com>
AuthorDate: Mon May 11 09:30:49 2020 +0900

    Remove unnecessary enter/leave_critical_section() in setlogmask() because 
it is MT-unsafe.
---
 libs/libc/syslog/lib_setlogmask.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/libs/libc/syslog/lib_setlogmask.c 
b/libs/libc/syslog/lib_setlogmask.c
index 02aaa70..ad5df88 100644
--- a/libs/libc/syslog/lib_setlogmask.c
+++ b/libs/libc/syslog/lib_setlogmask.c
@@ -1,7 +1,8 @@
 /****************************************************************************
  * lib/syslog/lib_setlogmask.c
  *
- *   Copyright (C) 2007-2009, 2011-2012, 2016 Gregory Nutt. All rights 
reserved.
+ *   Copyright (C) 2007-2009, 2011-2012, 2016 Gregory Nutt. All rights
+ *     reserved.
  *   Author: Gregory Nutt <gn...@nuttx.org>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -42,8 +43,6 @@
 #include <stdint.h>
 #include <syslog.h>
 
-#include <nuttx/irq.h>
-
 #include "syslog/syslog.h"
 
 /****************************************************************************
@@ -91,17 +90,9 @@ uint8_t g_syslog_mask = LOG_ALL;
 int setlogmask(int mask)
 {
   uint8_t oldmask;
-  irqstate_t flags;
-
-  /* These operations must be exclusive with respect to other threads as well
-   * as interrupts.
-   */
-
-  flags = enter_critical_section();
 
   oldmask       = g_syslog_mask;
   g_syslog_mask = (uint8_t)mask;
 
-  leave_critical_section(flags);
   return oldmask;
 }

Reply via email to