comp.lang.ada
 help / color / mirror / Atom feed
From: onox <denkpadje@gmail.com>
Subject: Re: Reference counter in smart pointers are not updated properly when used by multiple tasks
Date: Thu, 1 Feb 2018 02:01:21 -0800 (PST)
Date: 2018-02-01T02:01:21-08:00	[thread overview]
Message-ID: <634ea4dc-af9e-46d2-815b-af5a3aa2f6cd@googlegroups.com> (raw)
In-Reply-To: <p4ujnr$320$1@gioia.aioe.org>

On Thursday, February 1, 2018 at 9:39:24 AM UTC+1, Dmitry A. Kazakov wrote:
> On 01/02/2018 06:52, onox wrote:
> 
> > So the smart pointers are not working properly when there are jobs (paired with the same
> > smart pointer) being executed by multiple workers.
> 
> Depends on the implementation. Surely handling reference counts must be 
> done in a task-safe manner, e.g. through a protected action. Pragma 
> Atomic is no help here.

You're right Dimitry, using a protected object instead fixes the problem. But I do not understand why __sync_sub_and_fetch_4 is not sufficient. Could you explain?

  reply	other threads:[~2018-02-01 10:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-01  5:52 Reference counter in smart pointers are not updated properly when used by multiple tasks onox
2018-02-01  8:39 ` Dmitry A. Kazakov
2018-02-01 10:01   ` onox [this message]
2018-02-01 10:28     ` onox
2018-02-01 10:51       ` Dmitry A. Kazakov
2018-02-01 10:57     ` Dmitry A. Kazakov
2018-02-01  8:41 ` Simon Wright
2018-02-01 14:48 ` Jeffrey R. Carter
2018-02-01 19:37   ` onox
2018-02-01 20:12     ` Jeffrey R. Carter
2018-02-02  0:09   ` Randy Brukardt
2018-02-01 19:04 ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox