From: Jeremiah <jeremiah.breeden@gmail.com>
Subject: Re: Assignment with Adjust and Task Safety
Date: Fri, 25 Mar 2016 18:31:27 -0700 (PDT)
Date: 2016-03-25T18:31:27-07:00 [thread overview]
Message-ID: <a0c8cbb1-1578-475f-b083-f458716e1b45@googlegroups.com> (raw)
In-Reply-To: <ncs46a$qo2$1@gioia.aioe.org>
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.
>
> You add a mutex, global or of a narrower scope, and take it in Adjust
> 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 planning 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 of doing something).
next prev parent reply other threads:[~2016-03-26 1:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-22 14:36 Assignment with Adjust and Task Safety Jeremiah
2016-03-22 17:40 ` Shark8
2016-03-22 18:50 ` Dmitry A. Kazakov
2016-03-22 19:14 ` Randy Brukardt
2016-03-26 1:31 ` Jeremiah [this message]
2016-03-26 21:27 ` J-P. Rosen
2016-03-22 23:17 ` rieachus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox