[#BloombergLP-bslmt-ReaderWriterLock-tryUpgradeToWriteLock]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/ReaderWriterLock.adoc[ReaderWriterLock]::tryUpgradeToWriteLock
:relfileprefix: ../../../
:mrdocs:

Attempt to atomically convert a held read lock to a write lock&period;

== Synopsis

Declared in `&lt;bslmt&lowbar;readerwriterlock&period;h&gt;`

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

== Description

Attempt to atomically convert a read lock (acquired by a successful call to `lockRead`, `lockReadReserveWrite`, or `tryLockRead`) to a write lock&period; Return 0 on success, and a non&hyphen;zero value otherwise&period; If a write lock request is already pending, a non&hyphen;zero value is immediately returned&period; If there are other active read locks, the call will block until all current read locks are released&period; Note that locks that were acquired through `lockReadReserveWrite` are guaranteed to succeed&period;

== Return Value

0 on success, and a non&hyphen;zero value otherwise


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