\hypertarget{tsd_8h}{\section{opal/threads/tsd.h File Reference}
\label{tsd_8h}\index{opal/threads/tsd.\+h@{opal/threads/tsd.\+h}}
}


Thread Specific Datastore Interface.  


{\ttfamily \#include \char`\"{}opal\+\_\+config.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}opal/constants.\+h\char`\"{}}\\*
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{tsd_8h_a09d6ab7502e34329b6546c1e1f6545b4}{typedef void($\ast$ \hyperlink{tsd_8h_a09d6ab7502e34329b6546c1e1f6545b4}{opal\+\_\+tsd\+\_\+destructor\+\_\+t} )(void $\ast$value)}\label{tsd_8h_a09d6ab7502e34329b6546c1e1f6545b4}

\begin{DoxyCompactList}\small\item\em Prototype for callback when tsd data is being destroyed. \end{DoxyCompactList}\item 
\hypertarget{tsd_8h_a8453d52d86a28e0f30f1b0ada3c91b07}{typedef void $\ast$ \hyperlink{tsd_8h_a8453d52d86a28e0f30f1b0ada3c91b07}{opal\+\_\+tsd\+\_\+key\+\_\+t}}\label{tsd_8h_a8453d52d86a28e0f30f1b0ada3c91b07}

\begin{DoxyCompactList}\small\item\em Typedef for thread-\/specific data key. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{tsd_8h_a58090c4c8f8ec7eb06ffc5fe4e22f944}{opal\+\_\+tsd\+\_\+key\+\_\+create} (\hyperlink{tsd_8h_a8453d52d86a28e0f30f1b0ada3c91b07}{opal\+\_\+tsd\+\_\+key\+\_\+t} $\ast$key, \hyperlink{tsd_8h_a09d6ab7502e34329b6546c1e1f6545b4}{opal\+\_\+tsd\+\_\+destructor\+\_\+t} destructor)
\begin{DoxyCompactList}\small\item\em Create thread-\/specific data key. \end{DoxyCompactList}\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{tsd_8h_a11090942b25a7d45b6d4abdc7a293b7c}{opal\+\_\+tsd\+\_\+key\+\_\+delete} (\hyperlink{tsd_8h_a8453d52d86a28e0f30f1b0ada3c91b07}{opal\+\_\+tsd\+\_\+key\+\_\+t} key)
\begin{DoxyCompactList}\small\item\em Delete a thread-\/specific data key. \end{DoxyCompactList}\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{tsd_8h_abbb0f364801ed1d0d113cbc45bff19d1}{opal\+\_\+tsd\+\_\+setspecific} (\hyperlink{tsd_8h_a8453d52d86a28e0f30f1b0ada3c91b07}{opal\+\_\+tsd\+\_\+key\+\_\+t} key, void $\ast$value)
\begin{DoxyCompactList}\small\item\em Set a thread-\/specific data value. \end{DoxyCompactList}\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{tsd_8h_a3b08ecf9fcfeb03d17974aa2cc092256}{opal\+\_\+tsd\+\_\+getspecific} (\hyperlink{tsd_8h_a8453d52d86a28e0f30f1b0ada3c91b07}{opal\+\_\+tsd\+\_\+key\+\_\+t} key, void $\ast$$\ast$valuep)
\begin{DoxyCompactList}\small\item\em Get a thread-\/specific data value. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Thread Specific Datastore Interface. 

Functions for providing thread-\/specific datastore capabilities. 

\subsection{Function Documentation}
\hypertarget{tsd_8h_a3b08ecf9fcfeb03d17974aa2cc092256}{\index{tsd.\+h@{tsd.\+h}!opal\+\_\+tsd\+\_\+getspecific@{opal\+\_\+tsd\+\_\+getspecific}}
\index{opal\+\_\+tsd\+\_\+getspecific@{opal\+\_\+tsd\+\_\+getspecific}!tsd.\+h@{tsd.\+h}}
\subsubsection[{opal\+\_\+tsd\+\_\+getspecific}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int opal\+\_\+tsd\+\_\+getspecific (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tsd\+\_\+key\+\_\+t}}]{key, }
\item[{void $\ast$$\ast$}]{valuep}
\end{DoxyParamCaption}
)}}\label{tsd_8h_a3b08ecf9fcfeb03d17974aa2cc092256}


Get a thread-\/specific data value. 

Get the data associated with the given key, as set by \hyperlink{tsd_8h_abbb0f364801ed1d0d113cbc45bff19d1}{opal\+\_\+tsd\+\_\+setspecific()}. If \hyperlink{tsd_8h_abbb0f364801ed1d0d113cbc45bff19d1}{opal\+\_\+tsd\+\_\+setspecific()} hasn't been called in the current thread with the given key, N\+U\+L\+L is returned in valuep.


\begin{DoxyParams}{Parameters}
{\em key\mbox{[}in\mbox{]}} & Thread specific data key to modify \\
\hline
{\em value\mbox{[}out\mbox{]}} & Value to associate with key\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em O\+P\+A\+L\+\_\+\+S\+U\+C\+C\+E\+S\+S} & Success \\
\hline
{\em E\+N\+O\+M\+E\+M} & Insufficient memory exists to associate the value with the key \\
\hline
{\em E\+I\+N\+V\+A\+L} & Invalid key \\
\hline
\end{DoxyRetVals}
\hypertarget{tsd_8h_a58090c4c8f8ec7eb06ffc5fe4e22f944}{\index{tsd.\+h@{tsd.\+h}!opal\+\_\+tsd\+\_\+key\+\_\+create@{opal\+\_\+tsd\+\_\+key\+\_\+create}}
\index{opal\+\_\+tsd\+\_\+key\+\_\+create@{opal\+\_\+tsd\+\_\+key\+\_\+create}!tsd.\+h@{tsd.\+h}}
\subsubsection[{opal\+\_\+tsd\+\_\+key\+\_\+create}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int opal\+\_\+tsd\+\_\+key\+\_\+create (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tsd\+\_\+key\+\_\+t} $\ast$}]{key, }
\item[{{\bf opal\+\_\+tsd\+\_\+destructor\+\_\+t}}]{destructor}
\end{DoxyParamCaption}
)}}\label{tsd_8h_a58090c4c8f8ec7eb06ffc5fe4e22f944}


Create thread-\/specific data key. 

Create a thread-\/specific data key visible to all threads in the current process. The returned key is valid in all threads, although the values bound to the key by \hyperlink{tsd_8h_abbb0f364801ed1d0d113cbc45bff19d1}{opal\+\_\+tsd\+\_\+setspecific()} are allocated on a per-\/thread basis and persist for the life of the calling thread.

Upon key creation, the value N\+U\+L\+L is associated with the new key in all active threads. When a new thread is created, the value N\+U\+L\+L is associated with all defined keys in the new thread.

The destructor parameter may be N\+U\+L\+L. At thread exit, if destructor is non-\/\+N\+U\+L\+L A\+N\+D the thread has a non-\/\+N\+U\+L\+L value associated with the key, the function is called with the current value as its argument.


\begin{DoxyParams}{Parameters}
{\em key\mbox{[}out\mbox{]}} & The key for accessing thread-\/specific data \\
\hline
{\em destructor\mbox{[}in\mbox{]}} & Cleanup function to call when a thread exits\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em O\+P\+A\+L\+\_\+\+S\+U\+C\+C\+E\+S\+S} & Success \\
\hline
{\em E\+A\+G\+A\+I\+N} & The system lacked the necessary resource to create another thread specific data key \\
\hline
{\em E\+N\+O\+M\+E\+M} & Insufficient memory exists to create the key \\
\hline
\end{DoxyRetVals}
\hypertarget{tsd_8h_a11090942b25a7d45b6d4abdc7a293b7c}{\index{tsd.\+h@{tsd.\+h}!opal\+\_\+tsd\+\_\+key\+\_\+delete@{opal\+\_\+tsd\+\_\+key\+\_\+delete}}
\index{opal\+\_\+tsd\+\_\+key\+\_\+delete@{opal\+\_\+tsd\+\_\+key\+\_\+delete}!tsd.\+h@{tsd.\+h}}
\subsubsection[{opal\+\_\+tsd\+\_\+key\+\_\+delete}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int opal\+\_\+tsd\+\_\+key\+\_\+delete (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tsd\+\_\+key\+\_\+t}}]{key}
\end{DoxyParamCaption}
)}}\label{tsd_8h_a11090942b25a7d45b6d4abdc7a293b7c}


Delete a thread-\/specific data key. 

Delete a thread-\/specific data key previously returned by \hyperlink{tsd_8h_a58090c4c8f8ec7eb06ffc5fe4e22f944}{opal\+\_\+tsd\+\_\+key\+\_\+create()}. The destructor associated with the key is not fired in any thread and memory cleanup is the responsibility of the caller.

\begin{DoxyNote}{Note}
Unlike pthread\+\_\+key\+\_\+delete, this function should not be called from within a destructor. It can not be universally supported at this time.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em key\mbox{[}in\mbox{]}} & The key for accessing thread-\/specific data\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em O\+P\+A\+L\+\_\+\+S\+U\+C\+C\+E\+S\+S} & Success \\
\hline
{\em E\+I\+N\+V\+A\+L} & Invalid key \\
\hline
\end{DoxyRetVals}
\hypertarget{tsd_8h_abbb0f364801ed1d0d113cbc45bff19d1}{\index{tsd.\+h@{tsd.\+h}!opal\+\_\+tsd\+\_\+setspecific@{opal\+\_\+tsd\+\_\+setspecific}}
\index{opal\+\_\+tsd\+\_\+setspecific@{opal\+\_\+tsd\+\_\+setspecific}!tsd.\+h@{tsd.\+h}}
\subsubsection[{opal\+\_\+tsd\+\_\+setspecific}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int opal\+\_\+tsd\+\_\+setspecific (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tsd\+\_\+key\+\_\+t}}]{key, }
\item[{void $\ast$}]{value}
\end{DoxyParamCaption}
)}}\label{tsd_8h_abbb0f364801ed1d0d113cbc45bff19d1}


Set a thread-\/specific data value. 

Associates value with key in the current thread. The value for the key in other threads is not changed. Different threads may assign different values to the same key.

\begin{DoxyNote}{Note}
This function should not be called within \hyperlink{tsd_8h_a11090942b25a7d45b6d4abdc7a293b7c}{opal\+\_\+tsd\+\_\+key\+\_\+delete()}.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em key\mbox{[}in\mbox{]}} & Thread specific data key to modify \\
\hline
{\em value\mbox{[}in\mbox{]}} & Value to associate with key\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em O\+P\+A\+L\+\_\+\+S\+U\+C\+C\+E\+S\+S} & Success \\
\hline
{\em E\+N\+O\+M\+E\+M} & Insufficient memory exists to associate the value with the key \\
\hline
{\em E\+I\+N\+V\+A\+L} & Invalid key \\
\hline
\end{DoxyRetVals}
