tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

pr_atomicset.rst (751B)


      1 PR_AtomicSet
      2 ============
      3 
      4 Atomically sets a 32-bit value and return its previous contents.
      5 
      6 
      7 Syntax
      8 ------
      9 
     10 .. code::
     11 
     12   #include <pratom.h>
     13 
     14   PRInt32 PR_AtomicSet(
     15     PRInt32 *val,
     16     PRInt32 newval);
     17 
     18 
     19 Parameters
     20 ~~~~~~~~~~
     21 
     22 The function has the following parameter:
     23 
     24 ``val``
     25   A pointer to the value to be set.
     26 ``newval``
     27   The new value to assign to the ``val`` parameter.
     28 
     29 
     30 Returns
     31 ~~~~~~~
     32 
     33 The function returns the prior value of the referenced variable.
     34 
     35 
     36 Description
     37 -----------
     38 
     39 :ref:`PR_AtomicSet` first reads the value of var, then updates it with the
     40 supplied value. The returned value is the value that was read\ *before*
     41 memory was updated. The memory modification is unconditional--that is,
     42 it isn't a test and set operation.