\hypertarget{RW_8ih}{
\section{RW.ih File Reference}
\label{RW_8ih}\index{RW.ih@{RW.ih}}
}
Resource Wait, inline version. 

{\tt \#include \char`\"{}PBI/Inline.h\char`\"{}}\par
{\tt \#include \char`\"{}PBI/Attribute.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/RW.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/RW\_\-pubdefs.h\char`\"{}}\par


Include dependency graph for RW.ih:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=321pt]{RW_8ih__incl}
\end{center}
\end{figure}


This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=142pt]{RW_8ih__dep__incl}
\end{center}
\end{figure}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\hypertarget{RW_8ih_a0}{
\#define \hyperlink{RW_8ih_a0}{RW\_\-\_\-EXP\_\-PROTO}~INLINE\_\-USR\_\-EXP\_\-PROTO}
\label{RW_8ih_a0}

\begin{CompactList}\small\item\em Export Prototype spec. \item\end{CompactList}\item 
\hypertarget{RW_8ih_a1}{
\#define \hyperlink{RW_8ih_a1}{RW\_\-\_\-LCL\_\-PROTO}~INLINE\_\-USR\_\-LCL\_\-PROTO}
\label{RW_8ih_a1}

\begin{CompactList}\small\item\em Internal Prototype spec. \item\end{CompactList}\item 
\hypertarget{RW_8ih_a2}{
\#define \hyperlink{RW_8ih_a2}{RW\_\-\_\-EXP\_\-FNC}~INLINE\_\-USR\_\-EXP\_\-FNC}
\label{RW_8ih_a2}

\begin{CompactList}\small\item\em Export Function declaration. \item\end{CompactList}\item 
\hypertarget{RW_8ih_a3}{
\#define \hyperlink{RW_8ih_a3}{RW\_\-\_\-LCL\_\-FNC}~INLINE\_\-USR\_\-LCL\_\-FNC}
\label{RW_8ih_a3}

\begin{CompactList}\small\item\em Internal Function declaration. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
RW\_\-\_\-EXP\_\-PROTO int \hyperlink{RW_8ih_a4}{RW\_\-\_\-disable} (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$rw) ATTR\_\-UNUSED\_\-OK
\begin{CompactList}\small\item\em Disables wakeup calls. \item\end{CompactList}\item 
RW\_\-\_\-EXP\_\-PROTO int \hyperlink{RW_8ih_a5}{RW\_\-\_\-enable} (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$rw) ATTR\_\-UNUSED\_\-OK
\begin{CompactList}\small\item\em Enables wakeup calls. \item\end{CompactList}\item 
RW\_\-\_\-EXP\_\-PROTO int \hyperlink{RW_8ih_a6}{RW\_\-\_\-enabled} (const \hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$rw) ATTR\_\-UNUSED\_\-OK
\begin{CompactList}\small\item\em Returns the state of the enabled flag. \item\end{CompactList}\item 
RW\_\-\_\-EXP\_\-PROTO \hyperlink{RW__comdefs_8h_a4}{RW\_\-key} \hyperlink{RW_8ih_a7}{RW\_\-\_\-lock} (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$rw) ATTR\_\-UNUSED\_\-OK
\begin{CompactList}\small\item\em Locks a resource so it can be manipulated in an interlocked fashion. \item\end{CompactList}\item 
RW\_\-\_\-EXP\_\-PROTO \hyperlink{RW__comdefs_8h_a5}{RW\_\-keys} \hyperlink{RW_8ih_a8}{RW\_\-\_\-lock2} (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$rw\_\-0, \hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$rw\_\-1) ATTR\_\-UNUSED\_\-OK
\begin{CompactList}\small\item\em Locks two resource so they can be manipulated in an interlocked fashion. \item\end{CompactList}\item 
RW\_\-\_\-EXP\_\-PROTO int \hyperlink{RW_8ih_a9}{RW\_\-\_\-unlock} (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$rw, \hyperlink{RW__comdefs_8h_a4}{RW\_\-key} key) ATTR\_\-UNUSED\_\-OK
\begin{CompactList}\small\item\em This routine unlocks a previously locked resource. \item\end{CompactList}\item 
RW\_\-\_\-EXP\_\-PROTO int \hyperlink{RW_8ih_a10}{RW\_\-\_\-unlock2} (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$rw\_\-0, \hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$rw\_\-1, \hyperlink{RW__comdefs_8h_a5}{RW\_\-keys} keys) ATTR\_\-UNUSED\_\-OK
\begin{CompactList}\small\item\em This routine unlocks a previously locked resource. \item\end{CompactList}\item 
RW\_\-\_\-EXP\_\-PROTO \hyperlink{RW__comdefs_8h_a4}{RW\_\-key} \hyperlink{RW_8ih_a11}{RW\_\-\_\-wait} (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$rw, \hyperlink{RW__comdefs_8h_a4}{RW\_\-key} key) ATTR\_\-UNUSED\_\-OK
\begin{CompactList}\small\item\em Blocks a task/thread until there is a reasonable chance that a resource is available. \item\end{CompactList}\item 
RW\_\-\_\-EXP\_\-PROTO int \hyperlink{RW_8ih_a12}{RW\_\-\_\-wake} (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$rw, \hyperlink{RW__comdefs_8h_a4}{RW\_\-key} key) ATTR\_\-UNUSED\_\-OK
\begin{CompactList}\small\item\em This provides the signaling mechanism to wake up a thread of code which is waiting for a resource. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Resource Wait, inline version. 

\begin{Desc}
\item[Author:]JJRussell - \href{mailto:russell@slac.stanford.edu}{\tt russell@slac.stanford.edu}\end{Desc}


\footnotesize\begin{verbatim}   CVS $Id: RW.ih,v 1.5 2005/10/01 01:00:12 russell Exp $
\end{verbatim}
\normalsize


\subsection{Function Documentation}
\hypertarget{RW_8ih_a4}{
\index{RW.ih@{RW.ih}!RW__disable@{RW\_\-\_\-disable}}
\index{RW__disable@{RW\_\-\_\-disable}!RW.ih@{RW.ih}}
\subsubsection[RW\_\-\_\-disable]{\setlength{\rightskip}{0pt plus 5cm}RW\_\-\_\-EXP\_\-FNC int RW\_\-\_\-disable (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$ {\em rw})}}
\label{RW_8ih_a4}


Disables wakeup calls. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em rw}]The resource wait control structure \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]RW was previously disabled \item[{\em !=0}]RW was previously enabled\end{description}
\end{Desc}
Wakeup calls are disabled by this call. Effectively wakeup calls issued during the time the RW control structure is disabled are pended until reenabled by calling {\em \hyperlink{RW_8ih_a5}{RW\_\-\_\-enable()}\/}.\hypertarget{RW_8ih_a5}{
\index{RW.ih@{RW.ih}!RW__enable@{RW\_\-\_\-enable}}
\index{RW__enable@{RW\_\-\_\-enable}!RW.ih@{RW.ih}}
\subsubsection[RW\_\-\_\-enable]{\setlength{\rightskip}{0pt plus 5cm}RW\_\-\_\-EXP\_\-FNC int RW\_\-\_\-enable (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$ {\em rw})}}
\label{RW_8ih_a5}


Enables wakeup calls. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em rw}]The resource wait control structure \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]RW was previously disabled \item[{\em !=0}]RW was previously enabled\end{description}
\end{Desc}
Wakeup calls are enabled by this call. The routine also issues a wakeup if there are any pending wakeup calls.\hypertarget{RW_8ih_a6}{
\index{RW.ih@{RW.ih}!RW__enabled@{RW\_\-\_\-enabled}}
\index{RW__enabled@{RW\_\-\_\-enabled}!RW.ih@{RW.ih}}
\subsubsection[RW\_\-\_\-enabled]{\setlength{\rightskip}{0pt plus 5cm}RW\_\-\_\-EXP\_\-FNC int RW\_\-\_\-enabled (const \hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$ {\em rw})}}
\label{RW_8ih_a6}


Returns the state of the enabled flag. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em rw}]The resource wait control structure \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]RW was previously disabled \item[{\em !=0}]RW was previously enabled\end{description}
\end{Desc}
\begin{Desc}
\item[Warning:]As with all queries of this type, the answer is only good until it changes. The user is cautioned on its usage. It is primarily provided as a debugging tool.\end{Desc}
\hypertarget{RW_8ih_a7}{
\index{RW.ih@{RW.ih}!RW__lock@{RW\_\-\_\-lock}}
\index{RW__lock@{RW\_\-\_\-lock}!RW.ih@{RW.ih}}
\subsubsection[RW\_\-\_\-lock]{\setlength{\rightskip}{0pt plus 5cm}RW\_\-\_\-EXP\_\-PROTO \hyperlink{RW__comdefs_8h_a4}{RW\_\-key} RW\_\-\_\-lock (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$ {\em rw})}}
\label{RW_8ih_a7}


Locks a resource so it can be manipulated in an interlocked fashion. 

\begin{Desc}
\item[Returns:]A key to be passed to the RW\_\-\_\-unlock routine.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em rw}]The RW handle\end{description}
\end{Desc}
\hypertarget{RW_8ih_a8}{
\index{RW.ih@{RW.ih}!RW__lock2@{RW\_\-\_\-lock2}}
\index{RW__lock2@{RW\_\-\_\-lock2}!RW.ih@{RW.ih}}
\subsubsection[RW\_\-\_\-lock2]{\setlength{\rightskip}{0pt plus 5cm}RW\_\-\_\-EXP\_\-PROTO \hyperlink{RW__comdefs_8h_a5}{RW\_\-keys} RW\_\-\_\-lock2 (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$ {\em rw\_\-0}, \hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$ {\em rw\_\-1})}}
\label{RW_8ih_a8}


Locks two resource so they can be manipulated in an interlocked fashion. 

\begin{Desc}
\item[Returns:]A set of keys to be passed to the RW\_\-\_\-unlock2 routine\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em rw\_\-0}]The RW handle of the first resource to be locked \item[{\em rw\_\-1}]The RW handle of the second resource to be locked\end{description}
\end{Desc}
\hypertarget{RW_8ih_a9}{
\index{RW.ih@{RW.ih}!RW__unlock@{RW\_\-\_\-unlock}}
\index{RW__unlock@{RW\_\-\_\-unlock}!RW.ih@{RW.ih}}
\subsubsection[RW\_\-\_\-unlock]{\setlength{\rightskip}{0pt plus 5cm}RW\_\-\_\-EXP\_\-PROTO int RW\_\-\_\-unlock (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$ {\em rw}, \hyperlink{RW__comdefs_8h_a4}{RW\_\-key} {\em key})}}
\label{RW_8ih_a9}


This routine unlocks a previously locked resource. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em rw}]The RW handle \item[{\em key}]The key used to lock the resource, returned from {\em RW\_\-\_\-lock\/} \end{description}
\end{Desc}
\hypertarget{RW_8ih_a10}{
\index{RW.ih@{RW.ih}!RW__unlock2@{RW\_\-\_\-unlock2}}
\index{RW__unlock2@{RW\_\-\_\-unlock2}!RW.ih@{RW.ih}}
\subsubsection[RW\_\-\_\-unlock2]{\setlength{\rightskip}{0pt plus 5cm}RW\_\-\_\-EXP\_\-PROTO int RW\_\-\_\-unlock2 (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$ {\em rw\_\-0}, \hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$ {\em rw\_\-1}, \hyperlink{RW__comdefs_8h_a5}{RW\_\-keys} {\em keys})}}
\label{RW_8ih_a10}


This routine unlocks a previously locked resource. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em rw\_\-0}]The RW handle of the first resource to be unlocked \item[{\em rw\_\-1}]The RW handle of the second resource to be unlocked \item[{\em keys}]The keys used to lock the resources, returned from {\em RW\_\-lock2\/} \end{description}
\end{Desc}
\hypertarget{RW_8ih_a11}{
\index{RW.ih@{RW.ih}!RW__wait@{RW\_\-\_\-wait}}
\index{RW__wait@{RW\_\-\_\-wait}!RW.ih@{RW.ih}}
\subsubsection[RW\_\-\_\-wait]{\setlength{\rightskip}{0pt plus 5cm}RW\_\-\_\-EXP\_\-PROTO \hyperlink{RW__comdefs_8h_a4}{RW\_\-key} RW\_\-\_\-wait (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$ {\em rw}, \hyperlink{RW__comdefs_8h_a4}{RW\_\-key} {\em key})}}
\label{RW_8ih_a11}


Blocks a task/thread until there is a reasonable chance that a resource is available. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em rw}]The RW handle \item[{\em key}]The key used to unlock the interrupts \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Status\end{Desc}
\hypertarget{RW_8ih_a12}{
\index{RW.ih@{RW.ih}!RW__wake@{RW\_\-\_\-wake}}
\index{RW__wake@{RW\_\-\_\-wake}!RW.ih@{RW.ih}}
\subsubsection[RW\_\-\_\-wake]{\setlength{\rightskip}{0pt plus 5cm}RW\_\-\_\-EXP\_\-PROTO int RW\_\-\_\-wake (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$ {\em rw}, \hyperlink{RW__comdefs_8h_a4}{RW\_\-key} {\em key})}}
\label{RW_8ih_a12}


This provides the signaling mechanism to wake up a thread of code which is waiting for a resource. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em rw}]The RW handle \item[{\em key}]The key used to unlock the resource. \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em Status}]This routine checks if any thread is waiting for a resource, and if so wakes that thread. The resource should be locked on entry to this routine. This routine always exits with the resource still locked.\end{description}
\end{Desc}
