From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.157.10.97 with SMTP id 88mr1561805otg.9.1458955887497; Fri, 25 Mar 2016 18:31:27 -0700 (PDT) X-Received: by 10.182.246.231 with SMTP id xz7mr150633obc.5.1458955887455; Fri, 25 Mar 2016 18:31:27 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!nt3no4608760igb.0!news-out.google.com!pn7ni16864igb.0!nntp.google.com!nt3no4608754igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 25 Mar 2016 18:31:27 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=71.171.109.232; posting-account=vk6_JwoAAABkMyHO1YfdP69Hm3CpbdGR NNTP-Posting-Host: 71.171.109.232 References: <2c50ad2f-e6d5-4dc9-b4d1-905409311a97@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Assignment with Adjust and Task Safety From: Jeremiah Injection-Date: Sat, 26 Mar 2016 01:31:27 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:29890 Date: 2016-03-25T18:31:27-07:00 List-Id: On Tuesday, March 22, 2016 at 2:50:56 PM UTC-4, Dmitry A. Kazakov wrote: > On 2016-03-22 15:36, Jeremiah wrote: > > I don't think atomic increment/decrement will fix this as the task > > switch happens outside of both Adjust and Finalize. Is there some other > > way to prevent this? I know at the higher level I can wrap > > Shared_Pointer_A into a protected type to ensure the assignments and > > reads from it are protected, but that is something normally out of the > > scope of the Shared_Pointer_Type. >=20 > You add a mutex, global or of a narrower scope, and take it in Adjust=20 > and Finalize before doing anything else with the pointer. Sorry for the late reply, I have been sick. Thank you (and all others) for= the responses. For those who were concerned, don't worry I wasn't plannin= g on exposing smart pointers directly like that nor using them globally. I= was just trying to make sure I understood the mechanics (I feel like it is= important to understand how things work even if they aren't the best way o= f doing something). =20