[#BloombergLP-bslma-SharedPtrRep-tryAcquireRef]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::xref:BloombergLP/bslma/SharedPtrRep.adoc[SharedPtrRep]::tryAcquireRef
:relfileprefix: ../../../
:mrdocs:

Try to atomically acquire a shared reference to the shared object&period;

== Synopsis

Declared in `&lt;bslma&lowbar;sharedptrrep&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
bool
tryAcquireRef();
----

== Description

Atomically acquire a shared reference to the shared object referred to by this representation, if the number of shared references is greater than 0, and do nothing otherwise&period; Return `true` if the acquire succeeds, and `false` otherwise&period; The behavior is undefined unless `0 &lt; numWeakReferences() &verbar;&verbar; 0 &lt; numReferences()`&period;

== Return Value

`true` if the acquire succeeds, and `false` otherwise


[.small]#Created with https://www.mrdocs.com[MrDocs]#
