From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 9B2A5385781B for ; Fri, 2 Apr 2021 19:20:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9B2A5385781B Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-350-aeUG9nh1MySTK6lZz1CX8A-1; Fri, 02 Apr 2021 15:20:41 -0400 X-MC-Unique: aeUG9nh1MySTK6lZz1CX8A-1 Received: by mail-pf1-f197.google.com with SMTP id a9so5795838pfo.10 for ; Fri, 02 Apr 2021 12:20:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=M1wU3xsnLfvsFMXZcbBBFNkjomv0kRm3FRERDJm9DmY=; b=iCA2isnw2tjNVV1SUBc/ycitSYqCLIG7bsLASr4uro6m2KfgBTii0EP+OpygtnZte+ Emua4GvJ5Uyfj3W4VPiavIKY2LLgw2RBrfbwyHIvWdUiwFGs608aMwNmt5yITzFFjk2c NdJlVcdSib6U8TjKelNrekgObvIsqBSIxLnsrMpbNp7rqKJA8dwUkKXHVdIJa7zEcNtt dqourCmGQnS7SJJH0xVR4jZKDfKi2b8+6SprcJw7UNOrgN9U0URsV0zpHzZIomHU1i3R CR47FuTcZVNuuW1wbEFvbMoHd/l0Ei/ifIYVnywTuIfA2xPOdkDYFOFpp66onRe16yJn frzg== X-Gm-Message-State: AOAM532TSbuzQBBiTbrHcHDVtUT2+ayvSqRxiFJXpUwRTv5xTqzbYlxh LMQUPlE7LUZ1K9EVmpxhwwraEkff1KDBDKdmiAmXmJUFRb/pE8TRaZVQd8Q6SnNdblKb4whCQ71 PIFRJl2N5mFmqeTPm4AvO/2/xBoPIWsU= X-Received: by 2002:a17:90a:5b11:: with SMTP id o17mr15744460pji.32.1617391239835; Fri, 02 Apr 2021 12:20:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZMMr0Vt+1i6tVx/KvXIe35gZm+lcxVgtWm5uGtYs8a/hqKRlapZO6r0HFR2GCrlqp/cRHfubfZmd2kvo5/vk= X-Received: by 2002:a17:90a:5b11:: with SMTP id o17mr15744440pji.32.1617391239559; Fri, 02 Apr 2021 12:20:39 -0700 (PDT) MIME-Version: 1.0 References: <05ad18dabb56d23d26f1d9c493bcce0c@nicolachel.net> <15c0dc57-264d-18b8-5589-87e50288f39f@nadler.com> <9d80da2e-002d-dc4e-7608-f70211291f47@nadler.com> In-Reply-To: <9d80da2e-002d-dc4e-7608-f70211291f47@nadler.com> From: Jeff Johnston Date: Fri, 2 Apr 2021 15:20:28 -0400 Message-ID: Subject: Re: Fw: Some questions on reentrancy, __DYNAMIC_REENT__ and _impure_ptr To: Dave Nadler Cc: Craig Howland , Newlib X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 19:20:45 -0000 Hi Dave, Yes, you can't use a single _impure_ptr for multiple threads. You need to either switch the value between threads or use __getreent() to get thread local storage. -- Jeff J. On Fri, Apr 2, 2021 at 2:36 PM Dave Nadler wrote: > Sorry if I was not clear: If you use one memory location for _impure_ptr, > and you have two processors running two threads, this does not work. > Instead an alternate mechanism (ie thread-local storage for this ptr) is > needed, > to support each concurrent thread with a separate reentrancy structure. > Hope I was clear this time! > Thanks, > Best Regards, Dve > > On 4/2/2021 12:51 PM, C Howland via Newlib wrote: > >> ------------------------------ > >> *From:* Newlib on behalf of Dave > Nadler < > >> drn@nadler.com> > >> *Sent:* Friday, April 2, 2021 7:34 AM > >> *To:* Nick > >> *Cc:* newlib@sourceware.org > >> *Subject:* Re: Some questions on reentrancy, __DYNAMIC_REENT__ and > >> _impure_ptr > >> > >> > >> Thanks Jeff also for answering the mutex question I missed. > >> One other issue I should have mentioned that becomes more important > daily: > >> If there are multiple processors the simple _impure_ptr mechanism won't > >> work... > >> > > Well, if you ignore the fact you have multiple processors and do nothing > > about it, then, sure, you'll have problems. But if you manage it (e.g. > > treating each processor as its own thread, or as independent of each > other, > > etc.), then multiple processors can work fine. (I have such systems > > working.) > > Craig > > > -- > Dave Nadler, USA East Coast voice (978) 263-0097, drn@nadler.com, Skype > Dave.Nadler1 > >