[#CRYPTO_atomic_add]
= CRYPTO&lowbar;atomic&lowbar;add
:mrdocs:

Atomically add `amount` to &ast;`val,` optionally under `lock&period;`

== Synopsis

Declared in `&lt;openssl&sol;crypto&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
CRYPTO&lowbar;atomic&lowbar;add(
    int* val,
    int amount,
    int* ret,
    xref:CRYPTO_RWLOCK.adoc[CRYPTO&lowbar;RWLOCK]* lock);
----

== Return Value

1 on success, or 0 on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *val*
| Integer to modify in place&period;
| *amount*
| Value added to &ast;`val&period;`
| *ret*
| Receives the post&hyphen;add value of &ast;`val&semi;` must not be NULL&period;
| *lock*
| Optional CRYPTO&lowbar;RWLOCK used when hardware atomics are unavailable, or NULL&period;
|===


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