\hypertarget{include_2opal_2sys_2atomic_8h}{\section{opal/include/opal/sys/atomic.h File Reference}
\label{include_2opal_2sys_2atomic_8h}\index{opal/include/opal/sys/atomic.\+h@{opal/include/opal/sys/atomic.\+h}}
}


Atomic operations.  


{\ttfamily \#include \char`\"{}opal\+\_\+config.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}opal/sys/architecture.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}opal/sys/atomic\+\_\+impl.\+h\char`\"{}}\\*
\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structopal__atomic__lock__t}{opal\+\_\+atomic\+\_\+lock\+\_\+t}
\begin{DoxyCompactList}\small\item\em Volatile lock object (with optional padding). \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\hypertarget{include_2opal_2sys_2atomic_8h_aa48619fa45f50f207e509e07898370f5}{\#define {\bfseries O\+M\+P\+I\+\_\+\+G\+C\+C\+\_\+\+I\+N\+L\+I\+N\+E\+\_\+\+A\+S\+S\+E\+M\+B\+L\+Y}~O\+P\+A\+L\+\_\+\+C\+\_\+\+G\+C\+C\+\_\+\+I\+N\+L\+I\+N\+E\+\_\+\+A\+S\+S\+E\+M\+B\+L\+Y}\label{include_2opal_2sys_2atomic_8h_aa48619fa45f50f207e509e07898370f5}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a5ca111c3c8aee86353465b4865187143}{\#define {\bfseries O\+M\+P\+I\+\_\+\+D\+E\+C\+\_\+\+I\+N\+L\+I\+N\+E\+\_\+\+A\+S\+S\+E\+M\+B\+L\+Y}~O\+P\+A\+L\+\_\+\+C\+\_\+\+D\+E\+C\+\_\+\+I\+N\+L\+I\+N\+E\+\_\+\+A\+S\+S\+E\+M\+B\+L\+Y}\label{include_2opal_2sys_2atomic_8h_a5ca111c3c8aee86353465b4865187143}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_ac1c24c3671b022ebccd009342cefb09b}{\#define {\bfseries O\+M\+P\+I\+\_\+\+X\+L\+C\+\_\+\+I\+N\+L\+I\+N\+E\+\_\+\+A\+S\+S\+E\+M\+B\+L\+Y}~O\+P\+A\+L\+\_\+\+C\+\_\+\+X\+L\+C\+\_\+\+I\+N\+L\+I\+N\+E\+\_\+\+A\+S\+S\+E\+M\+B\+L\+Y}\label{include_2opal_2sys_2atomic_8h_ac1c24c3671b022ebccd009342cefb09b}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a38d3a849dcccf68ccdd16b02f719a7a7}{\#define {\bfseries O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+I\+N\+L\+I\+N\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+M\+E\+M\+\_\+\+B\+A\+R\+R\+I\+E\+R}~0}\label{include_2opal_2sys_2atomic_8h_a38d3a849dcccf68ccdd16b02f719a7a7}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a736588cb0fc6a028564a9eda1b17f7cd}{\#define {\bfseries O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+I\+N\+L\+I\+N\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+C\+M\+P\+S\+E\+T\+\_\+32}~0}\label{include_2opal_2sys_2atomic_8h_a736588cb0fc6a028564a9eda1b17f7cd}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a8a7c9ab61d40bdc9b070723bbbdcf354}{\#define {\bfseries O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+I\+N\+L\+I\+N\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+C\+M\+P\+S\+E\+T\+\_\+64}~0}\label{include_2opal_2sys_2atomic_8h_a8a7c9ab61d40bdc9b070723bbbdcf354}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_ac4c5d416fe1b17771ea336a4dc64a1fa}{\#define {\bfseries O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+I\+N\+L\+I\+N\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+A\+D\+D\+\_\+32}~0}\label{include_2opal_2sys_2atomic_8h_ac4c5d416fe1b17771ea336a4dc64a1fa}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_aec90c72c22f5c9507f76bc469a033493}{\#define {\bfseries O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+I\+N\+L\+I\+N\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+S\+U\+B\+\_\+32}~0}\label{include_2opal_2sys_2atomic_8h_aec90c72c22f5c9507f76bc469a033493}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a4a351f35e6c171c1b3c00db0650e354e}{\#define {\bfseries O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+I\+N\+L\+I\+N\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+A\+D\+D\+\_\+64}~0}\label{include_2opal_2sys_2atomic_8h_a4a351f35e6c171c1b3c00db0650e354e}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a6d0fba3e0d20a7edeb5c9da2d71a960c}{\#define {\bfseries O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+I\+N\+L\+I\+N\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+S\+U\+B\+\_\+64}~0}\label{include_2opal_2sys_2atomic_8h_a6d0fba3e0d20a7edeb5c9da2d71a960c}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_af65a126e27d42c9f38090e76df3a02b5}{\#define {\bfseries O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+I\+N\+L\+I\+N\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+S\+W\+A\+P\+\_\+32}~0}\label{include_2opal_2sys_2atomic_8h_af65a126e27d42c9f38090e76df3a02b5}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_ad6f7930a31bfc7dd099e2c8b19e0f5f5}{\#define {\bfseries O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+I\+N\+L\+I\+N\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+S\+W\+A\+P\+\_\+64}~0}\label{include_2opal_2sys_2atomic_8h_ad6f7930a31bfc7dd099e2c8b19e0f5f5}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a6f100586ea9f5271d80e88690d113f7a}{\#define {\bfseries O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+S\+P\+I\+N\+L\+O\+C\+K\+S}~(O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+C\+M\+P\+S\+E\+T\+\_\+32 $\vert$$\vert$ O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+C\+M\+P\+S\+E\+T\+\_\+64)}\label{include_2opal_2sys_2atomic_8h_a6f100586ea9f5271d80e88690d113f7a}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a458e829426ff22a1acaeb0f3feaa31dd}{\#define {\bfseries O\+P\+A\+L\+\_\+\+N\+E\+E\+D\+\_\+\+I\+N\+L\+I\+N\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+S\+P\+I\+N\+L\+O\+C\+K\+S}}\label{include_2opal_2sys_2atomic_8h_a458e829426ff22a1acaeb0f3feaa31dd}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a12d38a0f4e70dfe9589b52e68f27bfff}{\#define {\bfseries O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+M\+A\+T\+H\+\_\+32}~O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+C\+M\+P\+S\+E\+T\+\_\+32}\label{include_2opal_2sys_2atomic_8h_a12d38a0f4e70dfe9589b52e68f27bfff}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_ab669239be3dd83d25e9e0b597e2e6185}{\#define {\bfseries O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+M\+A\+T\+H\+\_\+64}~0}\label{include_2opal_2sys_2atomic_8h_ab669239be3dd83d25e9e0b597e2e6185}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_ab669239be3dd83d25e9e0b597e2e6185}{\#define {\bfseries O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+M\+A\+T\+H\+\_\+64}~O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+C\+M\+P\+S\+E\+T\+\_\+64}\label{include_2opal_2sys_2atomic_8h_ab669239be3dd83d25e9e0b597e2e6185}

\item 
\#define \hyperlink{include_2opal_2sys_2atomic_8h_a721fb316421b29288564733415403bbc}{opal\+\_\+atomic\+\_\+cmpset}(A\+D\+D\+R, O\+L\+D\+V\+A\+L, N\+E\+W\+V\+A\+L)
\begin{DoxyCompactList}\small\item\em Atomic compare and set of pointer with relaxed semantics. \end{DoxyCompactList}\item 
\#define \hyperlink{include_2opal_2sys_2atomic_8h_aedee7021105bafcca98d2564760bccfd}{opal\+\_\+atomic\+\_\+cmpset\+\_\+acq}(A\+D\+D\+R, O\+L\+D\+V\+A\+L, N\+E\+W\+V\+A\+L)
\begin{DoxyCompactList}\small\item\em Atomic compare and set of pointer with acquire semantics. \end{DoxyCompactList}\item 
\#define \hyperlink{include_2opal_2sys_2atomic_8h_a8c206c1bf7a9b22ad320f8eb7080d79c}{opal\+\_\+atomic\+\_\+cmpset\+\_\+rel}(A\+D\+D\+R, O\+L\+D\+V\+A\+L, N\+E\+W\+V\+A\+L)
\begin{DoxyCompactList}\small\item\em Atomic compare and set of pointer with release semantics. \end{DoxyCompactList}\item 
\#define \hyperlink{include_2opal_2sys_2atomic_8h_a661bc8cc446888169d78ff4649f02ea7}{opal\+\_\+atomic\+\_\+add}(A\+D\+D\+R, V\+A\+L\+U\+E)
\begin{DoxyCompactList}\small\item\em Atomically increment the content depending on the type. \end{DoxyCompactList}\item 
\#define \hyperlink{include_2opal_2sys_2atomic_8h_a8a3c438b60f98280f0899e40dfb6e290}{opal\+\_\+atomic\+\_\+sub}(A\+D\+D\+R, V\+A\+L\+U\+E)
\begin{DoxyCompactList}\small\item\em Atomically decrement the content depending on the type. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a0a16d40520b5e15117e028c7f5cfdaa8}{typedef struct \hyperlink{structopal__atomic__lock__t}{opal\+\_\+atomic\+\_\+lock\+\_\+t} {\bfseries opal\+\_\+atomic\+\_\+lock\+\_\+t}}\label{include_2opal_2sys_2atomic_8h_a0a16d40520b5e15117e028c7f5cfdaa8}

\end{DoxyCompactItemize}
\subsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a99fb83031ce9923c84392b4e92f956b5}{enum \{ {\bfseries O\+P\+A\+L\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+U\+N\+L\+O\+C\+K\+E\+D} = 0, 
{\bfseries O\+P\+A\+L\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+L\+O\+C\+K\+E\+D} = 1
 \}}\label{include_2opal_2sys_2atomic_8h_a99fb83031ce9923c84392b4e92f956b5}

\begin{DoxyCompactList}\small\item\em Enumeration of lock states. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{include_2opal_2sys_2atomic_8h_a400b0c985ad3d63ff9b8c94a8f0773fe}{opal\+\_\+atomic\+\_\+mb} (void)
\begin{DoxyCompactList}\small\item\em Memory barrier. \end{DoxyCompactList}\item 
void \hyperlink{include_2opal_2sys_2atomic_8h_aa792da2396ade405dbcad8e5d03986f3}{opal\+\_\+atomic\+\_\+rmb} (void)
\begin{DoxyCompactList}\small\item\em Read memory barrier. \end{DoxyCompactList}\item 
void \hyperlink{include_2opal_2sys_2atomic_8h_a824ea6078b06c11f8f507ef99e98b125}{opal\+\_\+atomic\+\_\+wmb} (void)
\begin{DoxyCompactList}\small\item\em Write memory barrier. \end{DoxyCompactList}\item 
static void \hyperlink{include_2opal_2sys_2atomic_8h_a8b27d33774e851f1c21db80dbd003c08}{opal\+\_\+atomic\+\_\+init} (\hyperlink{structopal__atomic__lock__t}{opal\+\_\+atomic\+\_\+lock\+\_\+t} $\ast$lock, int32\+\_\+t value)
\begin{DoxyCompactList}\small\item\em Initialize a lock to value. \end{DoxyCompactList}\item 
static int \hyperlink{include_2opal_2sys_2atomic_8h_ad26144bab589e37fbe7104b497d2c16d}{opal\+\_\+atomic\+\_\+trylock} (\hyperlink{structopal__atomic__lock__t}{opal\+\_\+atomic\+\_\+lock\+\_\+t} $\ast$lock)
\begin{DoxyCompactList}\small\item\em Try to acquire a lock. \end{DoxyCompactList}\item 
static void \hyperlink{include_2opal_2sys_2atomic_8h_a037d3d59f528b601917f03df01933b0a}{opal\+\_\+atomic\+\_\+lock} (\hyperlink{structopal__atomic__lock__t}{opal\+\_\+atomic\+\_\+lock\+\_\+t} $\ast$lock)
\begin{DoxyCompactList}\small\item\em Acquire a lock by spinning. \end{DoxyCompactList}\item 
static void \hyperlink{include_2opal_2sys_2atomic_8h_a5dc0940843195b8f32fed0480846a61c}{opal\+\_\+atomic\+\_\+unlock} (\hyperlink{structopal__atomic__lock__t}{opal\+\_\+atomic\+\_\+lock\+\_\+t} $\ast$lock)
\begin{DoxyCompactList}\small\item\em Release a lock. \end{DoxyCompactList}\item 
\hypertarget{include_2opal_2sys_2atomic_8h_ac0ae50f6ee0b7656f69424493aee12b0}{int {\bfseries opal\+\_\+atomic\+\_\+cmpset\+\_\+32} (volatile int32\+\_\+t $\ast$addr, int32\+\_\+t oldval, int32\+\_\+t newval)}\label{include_2opal_2sys_2atomic_8h_ac0ae50f6ee0b7656f69424493aee12b0}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a45a1c54268e7e3269aeb0a63e6fb417c}{int {\bfseries opal\+\_\+atomic\+\_\+cmpset\+\_\+acq\+\_\+32} (volatile int32\+\_\+t $\ast$addr, int32\+\_\+t oldval, int32\+\_\+t newval)}\label{include_2opal_2sys_2atomic_8h_a45a1c54268e7e3269aeb0a63e6fb417c}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a011907676774ce927ad14a1c5d64f67f}{int {\bfseries opal\+\_\+atomic\+\_\+cmpset\+\_\+rel\+\_\+32} (volatile int32\+\_\+t $\ast$addr, int32\+\_\+t oldval, int32\+\_\+t newval)}\label{include_2opal_2sys_2atomic_8h_a011907676774ce927ad14a1c5d64f67f}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a80c9ac76e7c7f74444cdee5de7a1d2f8}{int {\bfseries opal\+\_\+atomic\+\_\+cmpset\+\_\+64} (volatile int64\+\_\+t $\ast$addr, int64\+\_\+t oldval, int64\+\_\+t newval)}\label{include_2opal_2sys_2atomic_8h_a80c9ac76e7c7f74444cdee5de7a1d2f8}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_ab4effcbd7fc16d2d8dc64745c49a743e}{int {\bfseries opal\+\_\+atomic\+\_\+cmpset\+\_\+acq\+\_\+64} (volatile int64\+\_\+t $\ast$addr, int64\+\_\+t oldval, int64\+\_\+t newval)}\label{include_2opal_2sys_2atomic_8h_ab4effcbd7fc16d2d8dc64745c49a743e}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a4fc2a455c8b3c01e590e3e456c7b9aaa}{int {\bfseries opal\+\_\+atomic\+\_\+cmpset\+\_\+rel\+\_\+64} (volatile int64\+\_\+t $\ast$addr, int64\+\_\+t oldval, int64\+\_\+t newval)}\label{include_2opal_2sys_2atomic_8h_a4fc2a455c8b3c01e590e3e456c7b9aaa}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a3141252c0e1b22eb9d0113897196fab2}{int32\+\_\+t {\bfseries opal\+\_\+atomic\+\_\+add\+\_\+32} (volatile int32\+\_\+t $\ast$addr, int delta)}\label{include_2opal_2sys_2atomic_8h_a3141252c0e1b22eb9d0113897196fab2}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_acf91d61b1bae9ac49e286168b2a69699}{int32\+\_\+t {\bfseries opal\+\_\+atomic\+\_\+sub\+\_\+32} (volatile int32\+\_\+t $\ast$addr, int delta)}\label{include_2opal_2sys_2atomic_8h_acf91d61b1bae9ac49e286168b2a69699}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a40ece7514667a20a61a575d389731c00}{int64\+\_\+t {\bfseries opal\+\_\+atomic\+\_\+add\+\_\+64} (volatile int64\+\_\+t $\ast$addr, int64\+\_\+t delta)}\label{include_2opal_2sys_2atomic_8h_a40ece7514667a20a61a575d389731c00}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a075cdbba49f06a1dc64ffa4bb9cff488}{int64\+\_\+t {\bfseries opal\+\_\+atomic\+\_\+sub\+\_\+64} (volatile int64\+\_\+t $\ast$addr, int64\+\_\+t delta)}\label{include_2opal_2sys_2atomic_8h_a075cdbba49f06a1dc64ffa4bb9cff488}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_aa0af92754e995af82fc07601e6e6bc70}{static size\+\_\+t {\bfseries opal\+\_\+atomic\+\_\+add\+\_\+size\+\_\+t} (volatile size\+\_\+t $\ast$addr, int delta)}\label{include_2opal_2sys_2atomic_8h_aa0af92754e995af82fc07601e6e6bc70}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a3f6929d12fb21204d6b11bca25faa1a4}{static size\+\_\+t {\bfseries opal\+\_\+atomic\+\_\+sub\+\_\+size\+\_\+t} (volatile size\+\_\+t $\ast$addr, int delta)}\label{include_2opal_2sys_2atomic_8h_a3f6929d12fb21204d6b11bca25faa1a4}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_aea62dd09721c2088d7b591a8a7424a70}{static int {\bfseries opal\+\_\+atomic\+\_\+cmpset\+\_\+xx} (volatile void $\ast$addr, int64\+\_\+t oldval, int64\+\_\+t newval, size\+\_\+t length)}\label{include_2opal_2sys_2atomic_8h_aea62dd09721c2088d7b591a8a7424a70}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a655b2695f88bcde7b284af7bf2c1af60}{static int {\bfseries opal\+\_\+atomic\+\_\+cmpset\+\_\+acq\+\_\+xx} (volatile void $\ast$addr, int64\+\_\+t oldval, int64\+\_\+t newval, size\+\_\+t length)}\label{include_2opal_2sys_2atomic_8h_a655b2695f88bcde7b284af7bf2c1af60}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a54b4c8784841cbfe12044d977f7ded60}{static int {\bfseries opal\+\_\+atomic\+\_\+cmpset\+\_\+rel\+\_\+xx} (volatile void $\ast$addr, int64\+\_\+t oldval, int64\+\_\+t newval, size\+\_\+t length)}\label{include_2opal_2sys_2atomic_8h_a54b4c8784841cbfe12044d977f7ded60}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_adb819ce9ba845b006848cd35cd72b638}{static int {\bfseries opal\+\_\+atomic\+\_\+cmpset\+\_\+ptr} (volatile void $\ast$addr, void $\ast$oldval, void $\ast$newval)}\label{include_2opal_2sys_2atomic_8h_adb819ce9ba845b006848cd35cd72b638}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a001daa62d223517b81aa1e0726101c82}{static int {\bfseries opal\+\_\+atomic\+\_\+cmpset\+\_\+acq\+\_\+ptr} (volatile void $\ast$addr, void $\ast$oldval, void $\ast$newval)}\label{include_2opal_2sys_2atomic_8h_a001daa62d223517b81aa1e0726101c82}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a1615681318d8e072329dab8a850ede31}{static int {\bfseries opal\+\_\+atomic\+\_\+cmpset\+\_\+rel\+\_\+ptr} (volatile void $\ast$addr, void $\ast$oldval, void $\ast$newval)}\label{include_2opal_2sys_2atomic_8h_a1615681318d8e072329dab8a850ede31}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_adb3c306030b249f9466a42303ac89f90}{static void {\bfseries opal\+\_\+atomic\+\_\+add\+\_\+xx} (volatile void $\ast$addr, int32\+\_\+t value, size\+\_\+t length)}\label{include_2opal_2sys_2atomic_8h_adb3c306030b249f9466a42303ac89f90}

\item 
\hypertarget{include_2opal_2sys_2atomic_8h_a3b33ce7396a40dd8a9f126f6a00d6068}{static void {\bfseries opal\+\_\+atomic\+\_\+sub\+\_\+xx} (volatile void $\ast$addr, int32\+\_\+t value, size\+\_\+t length)}\label{include_2opal_2sys_2atomic_8h_a3b33ce7396a40dd8a9f126f6a00d6068}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
Atomic operations. 

This A\+P\+I is patterned after the Free\+B\+S\+D kernel atomic interface (which is influenced by Intel's ia64 architecture). The Free\+B\+S\+D interface is documented at

\href{http://www.freebsd.org/cgi/man.cgi?query=atomic&sektion=9}{\tt http\+://www.\+freebsd.\+org/cgi/man.\+cgi?query=atomic\&sektion=9}

Only the necessary subset of functions are implemented here.

The following \#defines will be true / false based on assembly support\+:


\begin{DoxyItemize}
\item {\ttfamily O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+M\+E\+M\+\_\+\+B\+A\+R\+R\+I\+E\+R} atomic memory barriers
\item {\ttfamily O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+S\+P\+I\+N\+L\+O\+C\+K\+S} atomic spinlocks
\item {\ttfamily O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+M\+A\+T\+H\+\_\+32} if 32 bit add/sub/cmpset can be done \char`\"{}atomicly\char`\"{}
\item {\ttfamily O\+P\+A\+L\+\_\+\+H\+A\+V\+E\+\_\+\+A\+T\+O\+M\+I\+C\+\_\+\+M\+A\+T\+H\+\_\+64} if 32 bit add/sub/cmpset can be done \char`\"{}atomicly\char`\"{}
\end{DoxyItemize}

Note that for the Atomic math, atomic add/sub may be implemented as C code using opal\+\_\+atomic\+\_\+cmpset. The appearance of atomic operation will be upheld in these cases. 

\subsection{Macro Definition Documentation}
\hypertarget{include_2opal_2sys_2atomic_8h_a661bc8cc446888169d78ff4649f02ea7}{\index{include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}!opal\+\_\+atomic\+\_\+add@{opal\+\_\+atomic\+\_\+add}}
\index{opal\+\_\+atomic\+\_\+add@{opal\+\_\+atomic\+\_\+add}!include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}}
\subsubsection[{opal\+\_\+atomic\+\_\+add}]{\setlength{\rightskip}{0pt plus 5cm}\#define opal\+\_\+atomic\+\_\+add(
\begin{DoxyParamCaption}
\item[{}]{A\+D\+D\+R, }
\item[{}]{V\+A\+L\+U\+E}
\end{DoxyParamCaption}
)}}\label{include_2opal_2sys_2atomic_8h_a661bc8cc446888169d78ff4649f02ea7}
{\bfseries Value\+:}
\begin{DoxyCode}
opal\_atomic\_add\_xx( (\textcolor{keyword}{volatile} \textcolor{keywordtype}{void}*)(ADDR), (int32\_t)(VALUE), \(\backslash\)
                       \textcolor{keyword}{sizeof}(*(ADDR)) )
\end{DoxyCode}


Atomically increment the content depending on the type. 

This macro detect at compile time the type of the first argument and choose the correct function to be called.

\begin{DoxyNote}{Note}
This macro should only be used for integer types.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em addr} & Address of $<$\+T\+Y\+P\+E$>$ \\
\hline
{\em delta} & Value to add (converted to $<$\+T\+Y\+P\+E$>$). \\
\hline
\end{DoxyParams}


Referenced by mca\+\_\+coll\+\_\+sm\+\_\+barrier\+\_\+intra(), opal\+\_\+list\+\_\+insert(), and opal\+\_\+progress().

\hypertarget{include_2opal_2sys_2atomic_8h_a721fb316421b29288564733415403bbc}{\index{include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}!opal\+\_\+atomic\+\_\+cmpset@{opal\+\_\+atomic\+\_\+cmpset}}
\index{opal\+\_\+atomic\+\_\+cmpset@{opal\+\_\+atomic\+\_\+cmpset}!include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}}
\subsubsection[{opal\+\_\+atomic\+\_\+cmpset}]{\setlength{\rightskip}{0pt plus 5cm}\#define opal\+\_\+atomic\+\_\+cmpset(
\begin{DoxyParamCaption}
\item[{}]{A\+D\+D\+R, }
\item[{}]{O\+L\+D\+V\+A\+L, }
\item[{}]{N\+E\+W\+V\+A\+L}
\end{DoxyParamCaption}
)}}\label{include_2opal_2sys_2atomic_8h_a721fb316421b29288564733415403bbc}
{\bfseries Value\+:}
\begin{DoxyCode}
opal\_atomic\_cmpset\_xx( (\textcolor{keyword}{volatile} \textcolor{keywordtype}{void}*)(ADDR), (intptr\_t)(OLDVAL), \(\backslash\)
                          (intptr\_t)(NEWVAL), \textcolor{keyword}{sizeof}(*(ADDR)) )
\end{DoxyCode}


Atomic compare and set of pointer with relaxed semantics. 

This macro detect at compile time the type of the first argument and choose the correct function to be called.

\begin{DoxyNote}{Note}
This macro should only be used for integer types.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em addr} & Address of $<$\+T\+Y\+P\+E$>$. \\
\hline
{\em oldval} & Comparison value $<$\+T\+Y\+P\+E$>$. \\
\hline
{\em newval} & New value to set if comparision is true $<$\+T\+Y\+P\+E$>$.\\
\hline
\end{DoxyParams}
See opal\+\_\+atomic\+\_\+cmpset\+\_\+$\ast$ for pseudo-\/code. \hypertarget{include_2opal_2sys_2atomic_8h_aedee7021105bafcca98d2564760bccfd}{\index{include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}!opal\+\_\+atomic\+\_\+cmpset\+\_\+acq@{opal\+\_\+atomic\+\_\+cmpset\+\_\+acq}}
\index{opal\+\_\+atomic\+\_\+cmpset\+\_\+acq@{opal\+\_\+atomic\+\_\+cmpset\+\_\+acq}!include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}}
\subsubsection[{opal\+\_\+atomic\+\_\+cmpset\+\_\+acq}]{\setlength{\rightskip}{0pt plus 5cm}\#define opal\+\_\+atomic\+\_\+cmpset\+\_\+acq(
\begin{DoxyParamCaption}
\item[{}]{A\+D\+D\+R, }
\item[{}]{O\+L\+D\+V\+A\+L, }
\item[{}]{N\+E\+W\+V\+A\+L}
\end{DoxyParamCaption}
)}}\label{include_2opal_2sys_2atomic_8h_aedee7021105bafcca98d2564760bccfd}
{\bfseries Value\+:}
\begin{DoxyCode}
opal\_atomic\_cmpset\_acq\_xx( (\textcolor{keyword}{volatile} \textcolor{keywordtype}{void}*)(ADDR), (int64\_t)(OLDVAL), \(\backslash\)
                              (int64\_t)(NEWVAL), \textcolor{keyword}{sizeof}(*(ADDR)) )
\end{DoxyCode}


Atomic compare and set of pointer with acquire semantics. 

This macro detect at compile time the type of the first argument and choose the correct function to be called.

\begin{DoxyNote}{Note}
This macro should only be used for integer types.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em addr} & Address of $<$\+T\+Y\+P\+E$>$. \\
\hline
{\em oldval} & Comparison value $<$\+T\+Y\+P\+E$>$. \\
\hline
{\em newval} & New value to set if comparision is true $<$\+T\+Y\+P\+E$>$.\\
\hline
\end{DoxyParams}
See opal\+\_\+atomic\+\_\+cmpset\+\_\+acq\+\_\+$\ast$ for pseudo-\/code. \hypertarget{include_2opal_2sys_2atomic_8h_a8c206c1bf7a9b22ad320f8eb7080d79c}{\index{include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}!opal\+\_\+atomic\+\_\+cmpset\+\_\+rel@{opal\+\_\+atomic\+\_\+cmpset\+\_\+rel}}
\index{opal\+\_\+atomic\+\_\+cmpset\+\_\+rel@{opal\+\_\+atomic\+\_\+cmpset\+\_\+rel}!include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}}
\subsubsection[{opal\+\_\+atomic\+\_\+cmpset\+\_\+rel}]{\setlength{\rightskip}{0pt plus 5cm}\#define opal\+\_\+atomic\+\_\+cmpset\+\_\+rel(
\begin{DoxyParamCaption}
\item[{}]{A\+D\+D\+R, }
\item[{}]{O\+L\+D\+V\+A\+L, }
\item[{}]{N\+E\+W\+V\+A\+L}
\end{DoxyParamCaption}
)}}\label{include_2opal_2sys_2atomic_8h_a8c206c1bf7a9b22ad320f8eb7080d79c}
{\bfseries Value\+:}
\begin{DoxyCode}
opal\_atomic\_cmpset\_rel\_xx( (\textcolor{keyword}{volatile} \textcolor{keywordtype}{void}*)(ADDR), (int64\_t)(OLDVAL), \(\backslash\)
                              (int64\_t)(NEWVAL), \textcolor{keyword}{sizeof}(*(ADDR)) )
\end{DoxyCode}


Atomic compare and set of pointer with release semantics. 

This macro detect at compile time the type of the first argument and choose the correct function to b

\begin{DoxyNote}{Note}
This macro should only be used for integer types.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em addr} & Address of $<$\+T\+Y\+P\+E$>$. \\
\hline
{\em oldval} & Comparison value $<$\+T\+Y\+P\+E$>$. \\
\hline
{\em newval} & New value to set if comparision is true $<$\+T\+Y\+P\+E$>$.\\
\hline
\end{DoxyParams}
See opal\+\_\+atomic\+\_\+cmpsetrel\+\_\+$\ast$ for pseudo-\/code. \hypertarget{include_2opal_2sys_2atomic_8h_a8a3c438b60f98280f0899e40dfb6e290}{\index{include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}!opal\+\_\+atomic\+\_\+sub@{opal\+\_\+atomic\+\_\+sub}}
\index{opal\+\_\+atomic\+\_\+sub@{opal\+\_\+atomic\+\_\+sub}!include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}}
\subsubsection[{opal\+\_\+atomic\+\_\+sub}]{\setlength{\rightskip}{0pt plus 5cm}\#define opal\+\_\+atomic\+\_\+sub(
\begin{DoxyParamCaption}
\item[{}]{A\+D\+D\+R, }
\item[{}]{V\+A\+L\+U\+E}
\end{DoxyParamCaption}
)}}\label{include_2opal_2sys_2atomic_8h_a8a3c438b60f98280f0899e40dfb6e290}
{\bfseries Value\+:}
\begin{DoxyCode}
opal\_atomic\_sub\_xx( (\textcolor{keyword}{volatile} \textcolor{keywordtype}{void}*)(ADDR), (int32\_t)(VALUE),        \(\backslash\)
                      \textcolor{keyword}{sizeof}(*(ADDR)) )
\end{DoxyCode}


Atomically decrement the content depending on the type. 

This macro detect at compile time the type of the first argument and choose the correct function to be called.

\begin{DoxyNote}{Note}
This macro should only be used for integer types.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em addr} & Address of $<$\+T\+Y\+P\+E$>$ \\
\hline
{\em delta} & Value to substract (converted to $<$\+T\+Y\+P\+E$>$). \\
\hline
\end{DoxyParams}


\subsection{Function Documentation}
\hypertarget{include_2opal_2sys_2atomic_8h_a8b27d33774e851f1c21db80dbd003c08}{\index{include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}!opal\+\_\+atomic\+\_\+init@{opal\+\_\+atomic\+\_\+init}}
\index{opal\+\_\+atomic\+\_\+init@{opal\+\_\+atomic\+\_\+init}!include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}}
\subsubsection[{opal\+\_\+atomic\+\_\+init}]{\setlength{\rightskip}{0pt plus 5cm}static void opal\+\_\+atomic\+\_\+init (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+atomic\+\_\+lock\+\_\+t} $\ast$}]{lock, }
\item[{int32\+\_\+t}]{value}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{include_2opal_2sys_2atomic_8h_a8b27d33774e851f1c21db80dbd003c08}


Initialize a lock to value. 


\begin{DoxyParams}{Parameters}
{\em lock} & Address of the lock \\
\hline
{\em value} & Initial value to set lock to \\
\hline
\end{DoxyParams}


Referenced by opal\+\_\+progress\+\_\+init(), and orte\+\_\+locks\+\_\+init().

\hypertarget{include_2opal_2sys_2atomic_8h_a037d3d59f528b601917f03df01933b0a}{\index{include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}!opal\+\_\+atomic\+\_\+lock@{opal\+\_\+atomic\+\_\+lock}}
\index{opal\+\_\+atomic\+\_\+lock@{opal\+\_\+atomic\+\_\+lock}!include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}}
\subsubsection[{opal\+\_\+atomic\+\_\+lock}]{\setlength{\rightskip}{0pt plus 5cm}static void opal\+\_\+atomic\+\_\+lock (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+atomic\+\_\+lock\+\_\+t} $\ast$}]{lock}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{include_2opal_2sys_2atomic_8h_a037d3d59f528b601917f03df01933b0a}


Acquire a lock by spinning. 


\begin{DoxyParams}{Parameters}
{\em lock} & Address of the lock. \\
\hline
\end{DoxyParams}


Referenced by mca\+\_\+btl\+\_\+sm\+\_\+component\+\_\+progress(), mca\+\_\+btl\+\_\+smcuda\+\_\+component\+\_\+progress(), opal\+\_\+class\+\_\+initialize(), opal\+\_\+progress\+\_\+finalize(), opal\+\_\+progress\+\_\+register(), and opal\+\_\+progress\+\_\+unregister().

\hypertarget{include_2opal_2sys_2atomic_8h_a400b0c985ad3d63ff9b8c94a8f0773fe}{\index{include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}!opal\+\_\+atomic\+\_\+mb@{opal\+\_\+atomic\+\_\+mb}}
\index{opal\+\_\+atomic\+\_\+mb@{opal\+\_\+atomic\+\_\+mb}!include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}}
\subsubsection[{opal\+\_\+atomic\+\_\+mb}]{\setlength{\rightskip}{0pt plus 5cm}void opal\+\_\+atomic\+\_\+mb (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}\label{include_2opal_2sys_2atomic_8h_a400b0c985ad3d63ff9b8c94a8f0773fe}


Memory barrier. 

Will use system-\/specific features to instruct the processor and memory controller that all writes and reads that have been posted before the call to {\ttfamily \hyperlink{include_2opal_2sys_2atomic_8h_a400b0c985ad3d63ff9b8c94a8f0773fe}{opal\+\_\+atomic\+\_\+mb()}} must appear to have completed before the next read or write.

\begin{DoxyNote}{Note}
This can have some expensive side effects, including flushing the pipeline, preventing the cpu from reordering instructions, and generally grinding the memory controller's performance. Use only if you need {\itshape both} read and write barriers. 
\end{DoxyNote}
\hypertarget{include_2opal_2sys_2atomic_8h_aa792da2396ade405dbcad8e5d03986f3}{\index{include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}!opal\+\_\+atomic\+\_\+rmb@{opal\+\_\+atomic\+\_\+rmb}}
\index{opal\+\_\+atomic\+\_\+rmb@{opal\+\_\+atomic\+\_\+rmb}!include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}}
\subsubsection[{opal\+\_\+atomic\+\_\+rmb}]{\setlength{\rightskip}{0pt plus 5cm}void opal\+\_\+atomic\+\_\+rmb (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}\label{include_2opal_2sys_2atomic_8h_aa792da2396ade405dbcad8e5d03986f3}


Read memory barrier. 

Use system-\/specific features to instruct the processor and memory conrtoller that all reads that have been posted before the call to {\ttfamily \hyperlink{include_2opal_2sys_2atomic_8h_aa792da2396ade405dbcad8e5d03986f3}{opal\+\_\+atomic\+\_\+rmb()}} must appear to have been completed before the next read. Nothing is said about the ordering of writes when using {\ttfamily \hyperlink{include_2opal_2sys_2atomic_8h_aa792da2396ade405dbcad8e5d03986f3}{opal\+\_\+atomic\+\_\+rmb()}}. 

Referenced by mca\+\_\+btl\+\_\+sm\+\_\+add\+\_\+procs(), mca\+\_\+btl\+\_\+smcuda\+\_\+add\+\_\+procs(), and mca\+\_\+mpool\+\_\+grdma\+\_\+evict().

\hypertarget{include_2opal_2sys_2atomic_8h_ad26144bab589e37fbe7104b497d2c16d}{\index{include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}!opal\+\_\+atomic\+\_\+trylock@{opal\+\_\+atomic\+\_\+trylock}}
\index{opal\+\_\+atomic\+\_\+trylock@{opal\+\_\+atomic\+\_\+trylock}!include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}}
\subsubsection[{opal\+\_\+atomic\+\_\+trylock}]{\setlength{\rightskip}{0pt plus 5cm}static int opal\+\_\+atomic\+\_\+trylock (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+atomic\+\_\+lock\+\_\+t} $\ast$}]{lock}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{include_2opal_2sys_2atomic_8h_ad26144bab589e37fbe7104b497d2c16d}


Try to acquire a lock. 


\begin{DoxyParams}{Parameters}
{\em lock} & Address of the lock. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if the lock was acquired, 1 otherwise. 
\end{DoxyReturn}


Referenced by orte\+\_\+finalize().

\hypertarget{include_2opal_2sys_2atomic_8h_a5dc0940843195b8f32fed0480846a61c}{\index{include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}!opal\+\_\+atomic\+\_\+unlock@{opal\+\_\+atomic\+\_\+unlock}}
\index{opal\+\_\+atomic\+\_\+unlock@{opal\+\_\+atomic\+\_\+unlock}!include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}}
\subsubsection[{opal\+\_\+atomic\+\_\+unlock}]{\setlength{\rightskip}{0pt plus 5cm}static void opal\+\_\+atomic\+\_\+unlock (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+atomic\+\_\+lock\+\_\+t} $\ast$}]{lock}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{include_2opal_2sys_2atomic_8h_a5dc0940843195b8f32fed0480846a61c}


Release a lock. 


\begin{DoxyParams}{Parameters}
{\em lock} & Address of the lock. \\
\hline
\end{DoxyParams}


Referenced by mca\+\_\+btl\+\_\+sm\+\_\+component\+\_\+progress(), mca\+\_\+btl\+\_\+smcuda\+\_\+component\+\_\+progress(), opal\+\_\+class\+\_\+initialize(), opal\+\_\+progress\+\_\+finalize(), opal\+\_\+progress\+\_\+register(), and opal\+\_\+progress\+\_\+unregister().

\hypertarget{include_2opal_2sys_2atomic_8h_a824ea6078b06c11f8f507ef99e98b125}{\index{include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}!opal\+\_\+atomic\+\_\+wmb@{opal\+\_\+atomic\+\_\+wmb}}
\index{opal\+\_\+atomic\+\_\+wmb@{opal\+\_\+atomic\+\_\+wmb}!include/opal/sys/atomic.\+h@{include/opal/sys/atomic.\+h}}
\subsubsection[{opal\+\_\+atomic\+\_\+wmb}]{\setlength{\rightskip}{0pt plus 5cm}void opal\+\_\+atomic\+\_\+wmb (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}\label{include_2opal_2sys_2atomic_8h_a824ea6078b06c11f8f507ef99e98b125}


Write memory barrier. 

Use system-\/specific features to instruct the processor and memory conrtoller that all writes that have been posted before the call to {\ttfamily \hyperlink{include_2opal_2sys_2atomic_8h_a824ea6078b06c11f8f507ef99e98b125}{opal\+\_\+atomic\+\_\+wmb()}} must appear to have been completed before the next write. Nothing is said about the ordering of reads when using {\ttfamily \hyperlink{include_2opal_2sys_2atomic_8h_a824ea6078b06c11f8f507ef99e98b125}{opal\+\_\+atomic\+\_\+wmb()}}. 

Referenced by mca\+\_\+btl\+\_\+sm\+\_\+add\+\_\+procs(), mca\+\_\+btl\+\_\+smcuda\+\_\+add\+\_\+procs(), mca\+\_\+coll\+\_\+sm\+\_\+bcast\+\_\+intra(), and mca\+\_\+mpool\+\_\+grdma\+\_\+evict().

