[Trilinos-Users] Is RCP in Teuchos thread safe?

Hoemmen, Mark mhoemme at sandia.gov
Thu Nov 12 16:23:52 EST 2015


On 11/12/15, 1:53 PM, "trilinos-users-request at trilinos.org"
<trilinos-users-request at trilinos.org> wrote:
>Message: 1
>Date: Tue, 27 Oct 2015 04:08:18 +0000
>From: "Teranishi, Keita" <knteran at sandia.gov>
>To: "trilinos-users at trilinos.org" <trilinos-users at trilinos.org>
>Subject: [Trilinos-Users] Is RCP in Teuchos thread safe?
>Message-ID: <D25446CA.B78D6%knteran at sandia.gov>
>Content-Type: text/plain; charset="us-ascii"
>
>Hi,
>
>Is RCP in Teuchos thread safe?  If not, should I build on my own (using
>qhtread/pthread)?

Ross answered the first question :-)

Answer to the second one: No.  Use std::shared_ptr (if you have C++11) or
boost::shared_ptr (if not).

Implementations of std::shared_ptr should use atomic updates for the
reference count, so they should work and be fast on any hardware that
supports atomic updates.  Implementations of boost::shared_ptr _do_ use
atomic updates for the reference count (Ross and I looked at this a while
back).  

mfh



More information about the Trilinos-Users mailing list