From commits-return-9412-archive-asf-public=cust-asf.ponee.io@nuttx.apache.org Mon May 11 05:04:05 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id A04241804BB for ; Mon, 11 May 2020 07:04:05 +0200 (CEST) Received: (qmail 59749 invoked by uid 500); 11 May 2020 05:04:05 -0000 Mailing-List: contact commits-help@nuttx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@nuttx.apache.org Delivered-To: mailing list commits@nuttx.apache.org Received: (qmail 59739 invoked by uid 99); 11 May 2020 05:04:04 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 May 2020 05:04:04 +0000 From: =?utf-8?q?GitBox?= To: commits@nuttx.apache.org Subject: =?utf-8?q?=5BGitHub=5D_=5Bincubator-nuttx=5D_patacongo_commented_on_a_change?= =?utf-8?q?_in_pull_request_=231023=3A_Fix_setlogmask=28=29_not_to_use_enter?= =?utf-8?q?=5Fcritical=5Fsection=28=29_in_protected_build?= Message-ID: <158917344480.4590.9518088382824101275.asfpy@gitbox.apache.org> Date: Mon, 11 May 2020 05:04:04 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit References: In-Reply-To: patacongo commented on a change in pull request #1023: URL: https://github.com/apache/incubator-nuttx/pull/1023#discussion_r422782172 ########## File path: libs/libc/syslog/lib_setlogmask.c ########## @@ -91,17 +96,29 @@ uint8_t g_syslog_mask = LOG_ALL; int setlogmask(int mask) { uint8_t oldmask; + +#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) Review comment: > > > The better fix is either: > 1.remove the critical section or > 2.replace with mutex/semphare > The mix just make the logic more complex and unmaintainable A pthread mutex cannot be across task groups (or at least should not because it breaks the usaage model). "pshared" semaphores (only) would be okay but would probably need to created via sem_open(). Test and set could probably also be used but is not available in all architectures. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org