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


{\tt \#include $<$PBI/Inline.h$>$}\par
{\tt \#include $<$PBI/Attribute.h$>$}\par
{\tt \#include $<$PBS/RW.h$>$}\par
{\tt \#include $<$PBS/RW\_\-pubdefs.h$>$}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\hypertarget{RW_8ih_d2e546d3b98ed99bd09c2191d434a61b}{
\#define \hyperlink{RW_8ih_d2e546d3b98ed99bd09c2191d434a61b}{RW\_\-\_\-EXP\_\-PROTO}~INLINE\_\-USR\_\-EXP\_\-PROTO}
\label{RW_8ih_d2e546d3b98ed99bd09c2191d434a61b}

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

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

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

\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_faa0baca97babc1339afdffb5b081712}{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_fe528a05f3c2aedca25ba70de605c453}{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_33399d1d13a0a907f107521883c59720}{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_50976fc21fa95d1f1dccc244ea9c1950}{RW\_\-key} \hyperlink{RW_8ih_ff3dadc0001dc3471a2fce136934a910}{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_d1f3df7b705727e88903537faa289b15}{RW\_\-keys} \hyperlink{RW_8ih_3f362e3db1d23346ff26ef1557da4ae7}{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_0cddc49386f89b744ac1e78129de0b80}{RW\_\-\_\-unlock} (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$rw, \hyperlink{RW__comdefs_8h_50976fc21fa95d1f1dccc244ea9c1950}{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_177bc72b5c2545232aab5035142bca5e}{RW\_\-\_\-unlock2} (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$rw\_\-0, \hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$rw\_\-1, \hyperlink{RW__comdefs_8h_d1f3df7b705727e88903537faa289b15}{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_50976fc21fa95d1f1dccc244ea9c1950}{RW\_\-key} \hyperlink{RW_8ih_15d9ea24b4ae64634d928419ec28a517}{RW\_\-\_\-wait} (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$rw, \hyperlink{RW__comdefs_8h_50976fc21fa95d1f1dccc244ea9c1950}{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_d2209e0c943b716875f50e031696c2c6}{RW\_\-\_\-wake} (\hyperlink{struct__RW__ctl}{RW\_\-ctl} $\ast$rw, \hyperlink{RW__comdefs_8h_50976fc21fa95d1f1dccc244ea9c1950}{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.6 2011/03/24 23:05:44 apw Exp $
\end{verbatim}
\normalsize
 

\subsection{Function Documentation}
\hypertarget{RW_8ih_faa0baca97babc1339afdffb5b081712}{
\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 ({\bf RW\_\-ctl} $\ast$ {\em rw})}}
\label{RW_8ih_faa0baca97babc1339afdffb5b081712}


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_fe528a05f3c2aedca25ba70de605c453}{RW\_\-\_\-enable()}\/}. 

References \_\-RW\_\-waitctl\_\-u::bf, RW\_\-\_\-lock(), RW\_\-\_\-unlock(), \_\-RW\_\-waitctl\_\-u::si, and \_\-RW\_\-ctl::waiting.

Referenced by LI\_\-\_\-disable(), and QI\_\-\_\-disable().\hypertarget{RW_8ih_fe528a05f3c2aedca25ba70de605c453}{
\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 ({\bf RW\_\-ctl} $\ast$ {\em rw})}}
\label{RW_8ih_fe528a05f3c2aedca25ba70de605c453}


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. 

References \_\-RW\_\-waitctl\_\-u::bf, RW\_\-\_\-lock(), RW\_\-\_\-unlock(), RW\_\-\_\-wake(), \_\-RW\_\-waitctl\_\-u::si, and \_\-RW\_\-ctl::waiting.

Referenced by LI\_\-\_\-enable(), and QI\_\-\_\-enable().\hypertarget{RW_8ih_33399d1d13a0a907f107521883c59720}{
\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 {\bf RW\_\-ctl} $\ast$ {\em rw})}}
\label{RW_8ih_33399d1d13a0a907f107521883c59720}


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}


References \_\-RW\_\-waitctl\_\-u::bf, and \_\-RW\_\-ctl::waiting.

Referenced by LI\_\-\_\-enabled(), LI\_\-\_\-remove(), QI\_\-\_\-enabled(), and QI\_\-\_\-remove().\hypertarget{RW_8ih_ff3dadc0001dc3471a2fce136934a910}{
\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 {\bf RW\_\-key} RW\_\-\_\-lock ({\bf RW\_\-ctl} $\ast$ {\em rw})}}
\label{RW_8ih_ff3dadc0001dc3471a2fce136934a910}


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}


References BUG\_\-check(), and \_\-RW\_\-ctl::mutex.

Referenced by FORK\_\-disable(), FORK\_\-enable(), FPA\_\-free(), FPA\_\-get(), LI\_\-\_\-insert(), LI\_\-\_\-jam(), LI\_\-\_\-remove(), PL\_\-\_\-insert(), PL\_\-\_\-jam(), PL\_\-\_\-remove(), PL\_\-\_\-wake(), QI\_\-\_\-insert(), QI\_\-\_\-jam(), QI\_\-\_\-remove(), RNG\_\-free(), RW\_\-\_\-disable(), RW\_\-\_\-enable(), RW\_\-free(), RW\_\-get(), and RW\_\-getW().\hypertarget{RW_8ih_3f362e3db1d23346ff26ef1557da4ae7}{
\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 {\bf RW\_\-keys} RW\_\-\_\-lock2 ({\bf RW\_\-ctl} $\ast$ {\em rw\_\-0}, \/  {\bf RW\_\-ctl} $\ast$ {\em rw\_\-1})}}
\label{RW_8ih_3f362e3db1d23346ff26ef1557da4ae7}


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}


References BUG\_\-check(), and \_\-RW\_\-ctl::mutex.

Referenced by LI\_\-\_\-append(), LI\_\-\_\-prepend(), QI\_\-\_\-append(), and QI\_\-\_\-prepend().\hypertarget{RW_8ih_0cddc49386f89b744ac1e78129de0b80}{
\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 ({\bf RW\_\-ctl} $\ast$ {\em rw}, \/  {\bf RW\_\-key} {\em key})}}
\label{RW_8ih_0cddc49386f89b744ac1e78129de0b80}


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}


References BUG\_\-check(), and \_\-RW\_\-ctl::mutex.

Referenced by FORK\_\-disable(), FORK\_\-enable(), FPA\_\-free(), FPA\_\-get(), LI\_\-\_\-insert(), LI\_\-\_\-jam(), LI\_\-\_\-remove(), PL\_\-\_\-insert(), PL\_\-\_\-jam(), PL\_\-\_\-remove(), PL\_\-\_\-wake(), QI\_\-\_\-insert(), QI\_\-\_\-jam(), QI\_\-\_\-remove(), RNG\_\-free(), RW\_\-\_\-disable(), RW\_\-\_\-enable(), RW\_\-free(), and RW\_\-getW().\hypertarget{RW_8ih_177bc72b5c2545232aab5035142bca5e}{
\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 ({\bf RW\_\-ctl} $\ast$ {\em rw\_\-0}, \/  {\bf RW\_\-ctl} $\ast$ {\em rw\_\-1}, \/  {\bf RW\_\-keys} {\em keys})}}
\label{RW_8ih_177bc72b5c2545232aab5035142bca5e}


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}


References BUG\_\-check(), and \_\-RW\_\-ctl::mutex.

Referenced by LI\_\-\_\-append(), LI\_\-\_\-prepend(), QI\_\-\_\-append(), and QI\_\-\_\-prepend().\hypertarget{RW_8ih_15d9ea24b4ae64634d928419ec28a517}{
\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 {\bf RW\_\-key} RW\_\-\_\-wait ({\bf RW\_\-ctl} $\ast$ {\em rw}, \/  {\bf RW\_\-key} {\em key})}}
\label{RW_8ih_15d9ea24b4ae64634d928419ec28a517}


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}


References \_\-RW\_\-waitctl\_\-u::bf, BUG\_\-check(), \_\-RW\_\-ctl::cond, \_\-RW\_\-ctl::mutex, and \_\-RW\_\-ctl::waiting.

Referenced by RW\_\-getW().\hypertarget{RW_8ih_d2209e0c943b716875f50e031696c2c6}{
\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 ({\bf RW\_\-ctl} $\ast$ {\em rw}, \/  {\bf RW\_\-key} {\em key})}}
\label{RW_8ih_d2209e0c943b716875f50e031696c2c6}


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}


References \_\-RW\_\-waitctl\_\-u::bf, \_\-RW\_\-ctl::cond, \_\-RW\_\-waitctl\_\-u::si, and \_\-RW\_\-ctl::waiting.

Referenced by FPA\_\-free(), LI\_\-\_\-insert(), LI\_\-\_\-jam(), PL\_\-\_\-insert(), PL\_\-\_\-jam(), PL\_\-\_\-wake(), QI\_\-\_\-insert(), QI\_\-\_\-jam(), RNG\_\-free(), RW\_\-\_\-enable(), and RW\_\-free().