\hypertarget{classTimerList}{
\section{TimerList Class Reference}
\label{classTimerList}\index{TimerList@{TimerList}}
}


\hyperlink{classXorpTimer}{XorpTimer} creation and scheduling entity.  




{\ttfamily \#include $<$timer.hh$>$}

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classTimerList_aa2df7379bab1562691414b907498f2d2}{TimerList} (\hyperlink{classClockBase}{ClockBase} $\ast$clock)
\item 
\hypertarget{classTimerList_a4971b9b429474a370c0b16cf792c4342}{
void \hyperlink{classTimerList_a4971b9b429474a370c0b16cf792c4342}{run} ()}
\label{classTimerList_a4971b9b429474a370c0b16cf792c4342}

\begin{DoxyCompactList}\small\item\em Expire all pending \hyperlink{classXorpTimer}{XorpTimer} objects associated with \hyperlink{classTimerList}{TimerList}. \item\end{DoxyCompactList}\item 
\hyperlink{classXorpTimer}{XorpTimer} \hyperlink{classTimerList_ab555418b603a68f36222522e3a313dba}{new\_\-oneoff\_\-at} (const \hyperlink{classTimeVal}{TimeVal} \&when, const OneoffTimerCallback \&ocb, int priority=XorpTask::PRIORITY\_\-DEFAULT)
\begin{DoxyCompactList}\small\item\em Create a \hyperlink{classXorpTimer}{XorpTimer} that will be scheduled once. \item\end{DoxyCompactList}\item 
\hyperlink{classXorpTimer}{XorpTimer} \hyperlink{classTimerList_a6e36f5c1fbbc8994a51abd23f5c1d340}{new\_\-oneoff\_\-after} (const \hyperlink{classTimeVal}{TimeVal} \&wait, const OneoffTimerCallback \&ocb, int priority=XorpTask::PRIORITY\_\-DEFAULT)
\begin{DoxyCompactList}\small\item\em Create a \hyperlink{classXorpTimer}{XorpTimer} that will be scheduled once. \item\end{DoxyCompactList}\item 
\hypertarget{classTimerList_a7b9d99d035808b11e12774992169dc11}{
void {\bfseries remove\_\-timer} (\hyperlink{classXorpTimer}{XorpTimer} \&t)}
\label{classTimerList_a7b9d99d035808b11e12774992169dc11}

\item 
\hyperlink{classXorpTimer}{XorpTimer} \hyperlink{classTimerList_a65b811efa27b4ef475ea8950da39d2ff}{new\_\-periodic} (const \hyperlink{classTimeVal}{TimeVal} \&wait, const PeriodicTimerCallback \&pcb, int priority=XorpTask::PRIORITY\_\-DEFAULT)
\begin{DoxyCompactList}\small\item\em Create a \hyperlink{classXorpTimer}{XorpTimer} that will invoke a callback periodically. \item\end{DoxyCompactList}\item 
\hyperlink{classXorpTimer}{XorpTimer} \hyperlink{classTimerList_abed920df1c070a70188335c8cf9f6cab}{set\_\-flag\_\-at} (const \hyperlink{classTimeVal}{TimeVal} \&when, bool $\ast$flag\_\-ptr, bool to\_\-value=true, int priority=XorpTask::PRIORITY\_\-DEFAULT)
\begin{DoxyCompactList}\small\item\em Create a \hyperlink{classXorpTimer}{XorpTimer} to set a flag. \item\end{DoxyCompactList}\item 
\hyperlink{classXorpTimer}{XorpTimer} \hyperlink{classTimerList_aae6a9b14ec3fa97522a2953ff97b0e46}{set\_\-flag\_\-after} (const \hyperlink{classTimeVal}{TimeVal} \&wait, bool $\ast$flag\_\-ptr, bool to\_\-value=true, int priority=XorpTask::PRIORITY\_\-DEFAULT)
\begin{DoxyCompactList}\small\item\em Create a \hyperlink{classXorpTimer}{XorpTimer} to set a flag. \item\end{DoxyCompactList}\item 
\hyperlink{classXorpTimer}{XorpTimer} \hyperlink{classTimerList_aa1f7554cf43a91101667f9bd1adfe688}{new\_\-timer} (const BasicTimerCallback \&cb)
\begin{DoxyCompactList}\small\item\em Custom \hyperlink{classXorpTimer}{XorpTimer} creation method. \item\end{DoxyCompactList}\item 
bool \hyperlink{classTimerList_af18bdbe7272e9cef5f6c0a93d464278b}{empty} () const 
\item 
size\_\-t \hyperlink{classTimerList_a07e71ad79a14c3fe8dc9e38bc3134f24}{size} () const 
\item 
bool \hyperlink{classTimerList_a41c82f81aecaa7d70af7a3dac0e08982}{get\_\-next\_\-delay} (\hyperlink{classTimeVal}{TimeVal} \&tv) const 
\begin{DoxyCompactList}\small\item\em Query \hyperlink{protocolthe-p}{the} next \hyperlink{classXorpTimer}{XorpTimer} Expiry time. \item\end{DoxyCompactList}\item 
int \hyperlink{classTimerList_aa08adbe09784e71b5c5fcdef9fc2e404}{get\_\-expired\_\-priority} () const 
\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} priority of \hyperlink{protocolthe-p}{the} highest priority timer that has expired. \item\end{DoxyCompactList}\item 
void \hyperlink{classTimerList_afc529234756c9d4fcabf489e67a5cd4f}{current\_\-time} (\hyperlink{classTimeVal}{TimeVal} \&now) const 
\begin{DoxyCompactList}\small\item\em Read \hyperlink{protocolthe-p}{the} latest known value from \hyperlink{protocolthe-p}{the} clock used by \hyperlink{classTimerList}{TimerList} object. \item\end{DoxyCompactList}\item 
void \hyperlink{classTimerList_aec05eab804a8bae7fc33937cfc56d5c4}{advance\_\-time} ()
\begin{DoxyCompactList}\small\item\em Advance time. \item\end{DoxyCompactList}\item 
void \hyperlink{classTimerList_a7ddf4333a6f37174de429433fbf76a9e}{set\_\-observer} (\hyperlink{classTimerListObserverBase}{TimerListObserverBase} \&obs)
\begin{DoxyCompactList}\small\item\em Register an observer object with this class. \item\end{DoxyCompactList}\item 
\hypertarget{classTimerList_ac874fab0b0cf71a0fa44f7c207b225f4}{
void \hyperlink{classTimerList_ac874fab0b0cf71a0fa44f7c207b225f4}{remove\_\-observer} ()}
\label{classTimerList_ac874fab0b0cf71a0fa44f7c207b225f4}

\begin{DoxyCompactList}\small\item\em Unregister \hyperlink{protocolthe-p}{the} current observer. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static void \hyperlink{classTimerList_a141ad0617906c67e660cd4ecbf081410}{system\_\-gettimeofday} (\hyperlink{classTimeVal}{TimeVal} $\ast$tv)
\begin{DoxyCompactList}\small\item\em Default time querier. \item\end{DoxyCompactList}\item 
static void \hyperlink{classTimerList_ad60ada0ae8b594d7f431a983391841c4}{system\_\-sleep} (const \hyperlink{classTimeVal}{TimeVal} \&tv)
\begin{DoxyCompactList}\small\item\em Suspend process execution for a defined interval. \item\end{DoxyCompactList}\item 
static \hyperlink{classTimerList}{TimerList} $\ast$ \hyperlink{classTimerList_a26c666b86385ae99fb8a62d35e153be7}{instance} ()
\begin{DoxyCompactList}\small\item\em Get pointer to sole \hyperlink{classTimerList}{TimerList} instance. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classTimerList_a193085c0b080afd815a95f2c5cd05cd2}{
void {\bfseries schedule\_\-node} (\hyperlink{classTimerNode}{TimerNode} $\ast$t)}
\label{classTimerList_a193085c0b080afd815a95f2c5cd05cd2}

\item 
\hypertarget{classTimerList_aaaaa9a80aefd102decc35aac2f9700fc}{
void {\bfseries unschedule\_\-node} (\hyperlink{classTimerNode}{TimerNode} $\ast$t)}
\label{classTimerList_aaaaa9a80aefd102decc35aac2f9700fc}

\item 
\hypertarget{classTimerList_acc62b425727da8b5b125793c02baa5fd}{
void {\bfseries acquire\_\-lock} () const }
\label{classTimerList_acc62b425727da8b5b125793c02baa5fd}

\item 
\hypertarget{classTimerList_aa3e80f29b560cb3d08cfe400103dfac6}{
bool {\bfseries attempt\_\-lock} () const }
\label{classTimerList_aa3e80f29b560cb3d08cfe400103dfac6}

\item 
\hypertarget{classTimerList_a765da47da64524a93827e37f253be9b8}{
void {\bfseries release\_\-lock} () const }
\label{classTimerList_a765da47da64524a93827e37f253be9b8}

\item 
\hypertarget{classTimerList_a3f5ba1f4f256c7adfa96117fbaecb79c}{
\hyperlink{classHeap}{Heap} $\ast$ {\bfseries find\_\-heap} (int priority)}
\label{classTimerList_a3f5ba1f4f256c7adfa96117fbaecb79c}

\item 
bool \hyperlink{classTimerList_aa84a427b0e43b276a8a95e83bb305a12}{expire\_\-one} (int worst\_\-priority)
\begin{DoxyCompactList}\small\item\em Expire one timer. \item\end{DoxyCompactList}\item 
\hypertarget{classTimerList_a1e4fff3d58d33c3456e998141c3422db}{
{\bfseries TimerList} (const \hyperlink{classTimerList}{TimerList} \&)}
\label{classTimerList_a1e4fff3d58d33c3456e998141c3422db}

\item 
\hypertarget{classTimerList_ac25cb9f3a6dc9c21b770b47071c29700}{
\hyperlink{classTimerList}{TimerList} \& {\bfseries operator=} (const \hyperlink{classTimerList}{TimerList} \&)}
\label{classTimerList_ac25cb9f3a6dc9c21b770b47071c29700}

\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classTimerList_a67c799845615233049fe0fa7d64f893a}{
map$<$ int, \hyperlink{classHeap}{Heap} $\ast$ $>$ {\bfseries \_\-heaplist}}
\label{classTimerList_a67c799845615233049fe0fa7d64f893a}

\item 
\hypertarget{classTimerList_ab5447cbd735acc48049df6623fc6472e}{
\hyperlink{classClockBase}{ClockBase} $\ast$ {\bfseries \_\-clock}}
\label{classTimerList_ab5447cbd735acc48049df6623fc6472e}

\item 
\hypertarget{classTimerList_a307d9132309ab6fb0dac630780c87959}{
\hyperlink{classTimerListObserverBase}{TimerListObserverBase} $\ast$ {\bfseries \_\-observer}}
\label{classTimerList_a307d9132309ab6fb0dac630780c87959}

\end{DoxyCompactItemize}
\subsection*{Friends}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classTimerList_a35483ca43de56344ebeb019dfdbc54b9}{
class \hyperlink{classTimerList_a35483ca43de56344ebeb019dfdbc54b9}{TimerNode}}
\label{classTimerList_a35483ca43de56344ebeb019dfdbc54b9}

\item 
\hypertarget{classTimerList_ab405ccec095afe5ce1798cb8b6a7f5f6}{
class \hyperlink{classTimerList_ab405ccec095afe5ce1798cb8b6a7f5f6}{TimerListObserverBase}}
\label{classTimerList_ab405ccec095afe5ce1798cb8b6a7f5f6}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
\hyperlink{classXorpTimer}{XorpTimer} creation and scheduling entity. A \hyperlink{classTimerList}{TimerList} is a scheduling entity that provides a means to create \hyperlink{classXorpTimer}{XorpTimer} objects and run them.

\hyperlink{classXorpTimer}{XorpTimer} objects created via \hyperlink{classTimerList}{TimerList} methods contain pointers to reference counted elements maintained in \hyperlink{protocolthe-p}{the} \hyperlink{classTimerList}{TimerList}. The elements on \hyperlink{protocolthe-p}{the} list need to be referenced by \hyperlink{classXorpTimer}{XorpTimer} objects or \hyperlink{protocolthe-p}{the} underlying timer callbacks are never made. For instance:


\begin{DoxyPre}
\hyperlink{classTimerList}{TimerList} timer\_list;\end{DoxyPre}



\begin{DoxyPre}\hyperlink{classXorpTimer}{XorpTimer} t = timer\_list.new\_oneoff\_after(TimeVal(0, 100000),
			callback(some\_function, some\_arg));\end{DoxyPre}



\begin{DoxyPre}new\_oneoff\_after(TimeVal(0, 200000), my\_callback\_b, my\_parameter\_a);\end{DoxyPre}



\begin{DoxyPre}while ( ! timer\_list.empty() ) \{
	timer\_list.run();
\}
\end{DoxyPre}


{\ttfamily my\_\-callback\_\-a} is called 100000us after \hyperlink{protocolthe-p}{the} \hyperlink{classXorpTimer}{XorpTimer} object is created.

{\ttfamily my\_\-callback\_\-b} is never called because no \hyperlink{classXorpTimer}{XorpTimer} references \hyperlink{protocolthe-p}{the} underlying element on \hyperlink{protocolthe-p}{the} \hyperlink{classTimerList}{TimerList} after {\ttfamily \hyperlink{classTimerList_a6e36f5c1fbbc8994a51abd23f5c1d340}{TimerList::new\_\-oneoff\_\-after()}} is called. 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{classTimerList_aa2df7379bab1562691414b907498f2d2}{
\index{TimerList@{TimerList}!TimerList@{TimerList}}
\index{TimerList@{TimerList}!TimerList@{TimerList}}
\subsubsection[{TimerList}]{\setlength{\rightskip}{0pt plus 5cm}TimerList::TimerList (
\begin{DoxyParamCaption}
\item[{{\bf ClockBase} $\ast$}]{clock}
\end{DoxyParamCaption}
)}}
\label{classTimerList_aa2df7379bab1562691414b907498f2d2}

\begin{DoxyParams}{Parameters}
{\em clock} & clock object to use to query time. \\
\hline
\end{DoxyParams}


\subsection{Member Function Documentation}
\hypertarget{classTimerList_aec05eab804a8bae7fc33937cfc56d5c4}{
\index{TimerList@{TimerList}!advance\_\-time@{advance\_\-time}}
\index{advance\_\-time@{advance\_\-time}!TimerList@{TimerList}}
\subsubsection[{advance\_\-time}]{\setlength{\rightskip}{0pt plus 5cm}void TimerList::advance\_\-time (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{classTimerList_aec05eab804a8bae7fc33937cfc56d5c4}


Advance time. 

This method fetches \hyperlink{protocolthe-p}{the} time from clock object associated with \hyperlink{protocolthe-p}{the} \hyperlink{classTimerList}{TimerList} and sets \hyperlink{protocolthe-p}{the} \hyperlink{classTimerList}{TimerList} current time to this value. \hypertarget{classTimerList_afc529234756c9d4fcabf489e67a5cd4f}{
\index{TimerList@{TimerList}!current\_\-time@{current\_\-time}}
\index{current\_\-time@{current\_\-time}!TimerList@{TimerList}}
\subsubsection[{current\_\-time}]{\setlength{\rightskip}{0pt plus 5cm}void TimerList::current\_\-time (
\begin{DoxyParamCaption}
\item[{{\bf TimeVal} \&}]{now}
\end{DoxyParamCaption}
) const}}
\label{classTimerList_afc529234756c9d4fcabf489e67a5cd4f}


Read \hyperlink{protocolthe-p}{the} latest known value from \hyperlink{protocolthe-p}{the} clock used by \hyperlink{classTimerList}{TimerList} object. 


\begin{DoxyParams}{Parameters}
{\em now} & \hyperlink{protocolthe-p}{the} return-\/by-\/reference value with \hyperlink{protocolthe-p}{the} current time. \\
\hline
\end{DoxyParams}
\hypertarget{classTimerList_af18bdbe7272e9cef5f6c0a93d464278b}{
\index{TimerList@{TimerList}!empty@{empty}}
\index{empty@{empty}!TimerList@{TimerList}}
\subsubsection[{empty}]{\setlength{\rightskip}{0pt plus 5cm}bool TimerList::empty (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classTimerList_af18bdbe7272e9cef5f6c0a93d464278b}
\begin{DoxyReturn}{Returns}
true if there no \hyperlink{classXorpTimer}{XorpTimer} objects currently scheduled on list. 
\end{DoxyReturn}
\hypertarget{classTimerList_aa84a427b0e43b276a8a95e83bb305a12}{
\index{TimerList@{TimerList}!expire\_\-one@{expire\_\-one}}
\index{expire\_\-one@{expire\_\-one}!TimerList@{TimerList}}
\subsubsection[{expire\_\-one}]{\setlength{\rightskip}{0pt plus 5cm}bool TimerList::expire\_\-one (
\begin{DoxyParamCaption}
\item[{int}]{worst\_\-priority}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classTimerList_aa84a427b0e43b276a8a95e83bb305a12}


Expire one timer. 

The timer we expire is \hyperlink{protocolthe-p}{the} highest priority (lowest priority number) timer that is less than or equal to \hyperlink{protocolthe-p}{the} \hyperlink{protocolthe-p}{the} parameter worst\_\-priority. \hypertarget{classTimerList_aa08adbe09784e71b5c5fcdef9fc2e404}{
\index{TimerList@{TimerList}!get\_\-expired\_\-priority@{get\_\-expired\_\-priority}}
\index{get\_\-expired\_\-priority@{get\_\-expired\_\-priority}!TimerList@{TimerList}}
\subsubsection[{get\_\-expired\_\-priority}]{\setlength{\rightskip}{0pt plus 5cm}int TimerList::get\_\-expired\_\-priority (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classTimerList_aa08adbe09784e71b5c5fcdef9fc2e404}


Get \hyperlink{protocolthe-p}{the} priority of \hyperlink{protocolthe-p}{the} highest priority timer that has expired. 

\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} priority of \hyperlink{protocolthe-p}{the} expired timer, or INFINITE\_\-PRIORITY if no timer has expired. 
\end{DoxyReturn}
\hypertarget{classTimerList_a41c82f81aecaa7d70af7a3dac0e08982}{
\index{TimerList@{TimerList}!get\_\-next\_\-delay@{get\_\-next\_\-delay}}
\index{get\_\-next\_\-delay@{get\_\-next\_\-delay}!TimerList@{TimerList}}
\subsubsection[{get\_\-next\_\-delay}]{\setlength{\rightskip}{0pt plus 5cm}bool TimerList::get\_\-next\_\-delay (
\begin{DoxyParamCaption}
\item[{{\bf TimeVal} \&}]{tv}
\end{DoxyParamCaption}
) const}}
\label{classTimerList_a41c82f81aecaa7d70af7a3dac0e08982}


Query \hyperlink{protocolthe-p}{the} next \hyperlink{classXorpTimer}{XorpTimer} Expiry time. 


\begin{DoxyParams}{Parameters}
{\em tv} & reference that is assigned expiry time of next timer. If there is no \hyperlink{classXorpTimer}{XorpTimer} pending, this value is assigned \hyperlink{protocolthe-p}{the} maximum \hyperlink{classTimeVal_a9af051452245ec6e5d2bcba8c4ae4ac2}{TimeVal::MAXIMUM()}. The first function returns \hyperlink{protocolthe-p}{the} absolute time at which \hyperlink{protocolthe-p}{the} timer expires, where \hyperlink{protocolthe-p}{the} second returns \hyperlink{protocolthe-p}{the} difference between now and \hyperlink{protocolthe-p}{the} expiry time.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if there is a \hyperlink{classXorpTimer}{XorpTimer} awaiting expiry, false otherwise. 
\end{DoxyReturn}
\hypertarget{classTimerList_a26c666b86385ae99fb8a62d35e153be7}{
\index{TimerList@{TimerList}!instance@{instance}}
\index{instance@{instance}!TimerList@{TimerList}}
\subsubsection[{instance}]{\setlength{\rightskip}{0pt plus 5cm}{\bf TimerList} $\ast$ TimerList::instance (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}static\mbox{]}}}}
\label{classTimerList_a26c666b86385ae99fb8a62d35e153be7}


Get pointer to sole \hyperlink{classTimerList}{TimerList} instance. 

\begin{DoxyReturn}{Returns}
pointer if \hyperlink{classTimerList}{TimerList} has been constructed, NULL otherwise. 
\end{DoxyReturn}
\hypertarget{classTimerList_a6e36f5c1fbbc8994a51abd23f5c1d340}{
\index{TimerList@{TimerList}!new\_\-oneoff\_\-after@{new\_\-oneoff\_\-after}}
\index{new\_\-oneoff\_\-after@{new\_\-oneoff\_\-after}!TimerList@{TimerList}}
\subsubsection[{new\_\-oneoff\_\-after}]{\setlength{\rightskip}{0pt plus 5cm}{\bf XorpTimer} TimerList::new\_\-oneoff\_\-after (
\begin{DoxyParamCaption}
\item[{const {\bf TimeVal} \&}]{wait, }
\item[{const OneoffTimerCallback \&}]{ocb, }
\item[{int}]{priority = {\ttfamily XorpTask::PRIORITY\_\-DEFAULT}}
\end{DoxyParamCaption}
)}}
\label{classTimerList_a6e36f5c1fbbc8994a51abd23f5c1d340}


Create a \hyperlink{classXorpTimer}{XorpTimer} that will be scheduled once. 


\begin{DoxyParams}{Parameters}
{\em wait} & \hyperlink{protocolthe-p}{the} relative time when \hyperlink{protocolthe-p}{the} timer expires. \\
\hline
{\em ocb} & callback object that is invoked when timer expires.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} \hyperlink{classXorpTimer}{XorpTimer} created. 
\end{DoxyReturn}
\hypertarget{classTimerList_ab555418b603a68f36222522e3a313dba}{
\index{TimerList@{TimerList}!new\_\-oneoff\_\-at@{new\_\-oneoff\_\-at}}
\index{new\_\-oneoff\_\-at@{new\_\-oneoff\_\-at}!TimerList@{TimerList}}
\subsubsection[{new\_\-oneoff\_\-at}]{\setlength{\rightskip}{0pt plus 5cm}{\bf XorpTimer} TimerList::new\_\-oneoff\_\-at (
\begin{DoxyParamCaption}
\item[{const {\bf TimeVal} \&}]{when, }
\item[{const OneoffTimerCallback \&}]{ocb, }
\item[{int}]{priority = {\ttfamily XorpTask::PRIORITY\_\-DEFAULT}}
\end{DoxyParamCaption}
)}}
\label{classTimerList_ab555418b603a68f36222522e3a313dba}


Create a \hyperlink{classXorpTimer}{XorpTimer} that will be scheduled once. 


\begin{DoxyParams}{Parameters}
{\em when} & \hyperlink{protocolthe-p}{the} absolute time when \hyperlink{protocolthe-p}{the} timer expires. \\
\hline
{\em ocb} & callback object that is invoked when timer expires.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} \hyperlink{classXorpTimer}{XorpTimer} created. 
\end{DoxyReturn}
\hypertarget{classTimerList_a65b811efa27b4ef475ea8950da39d2ff}{
\index{TimerList@{TimerList}!new\_\-periodic@{new\_\-periodic}}
\index{new\_\-periodic@{new\_\-periodic}!TimerList@{TimerList}}
\subsubsection[{new\_\-periodic}]{\setlength{\rightskip}{0pt plus 5cm}{\bf XorpTimer} TimerList::new\_\-periodic (
\begin{DoxyParamCaption}
\item[{const {\bf TimeVal} \&}]{wait, }
\item[{const PeriodicTimerCallback \&}]{pcb, }
\item[{int}]{priority = {\ttfamily XorpTask::PRIORITY\_\-DEFAULT}}
\end{DoxyParamCaption}
)}}
\label{classTimerList_a65b811efa27b4ef475ea8950da39d2ff}


Create a \hyperlink{classXorpTimer}{XorpTimer} that will invoke a callback periodically. 


\begin{DoxyParams}{Parameters}
{\em wait} & \hyperlink{protocolthe-p}{the} period when \hyperlink{protocolthe-p}{the} timer expires. \\
\hline
{\em pcb} & user callback object that is invoked when timer expires. If \hyperlink{protocolthe-p}{the} callback returns false \hyperlink{protocolthe-p}{the} periodic \hyperlink{classXorpTimer}{XorpTimer} is unscheduled.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} \hyperlink{classXorpTimer}{XorpTimer} created. 
\end{DoxyReturn}
\hypertarget{classTimerList_aa1f7554cf43a91101667f9bd1adfe688}{
\index{TimerList@{TimerList}!new\_\-timer@{new\_\-timer}}
\index{new\_\-timer@{new\_\-timer}!TimerList@{TimerList}}
\subsubsection[{new\_\-timer}]{\setlength{\rightskip}{0pt plus 5cm}{\bf XorpTimer} TimerList::new\_\-timer (
\begin{DoxyParamCaption}
\item[{const BasicTimerCallback \&}]{cb}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classTimerList_aa1f7554cf43a91101667f9bd1adfe688}


Custom \hyperlink{classXorpTimer}{XorpTimer} creation method. 

The \hyperlink{classXorpTimer}{XorpTimer} object created needs to be explicitly scheduled with \hyperlink{protocolthe-p}{the} available \hyperlink{classXorpTimer}{XorpTimer} methods.


\begin{DoxyParams}{Parameters}
{\em hook} & user function to be invoked when \hyperlink{classXorpTimer}{XorpTimer} expires.\\
\hline
{\em thunk} & user argument to be passed when user's function is invoked.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} \hyperlink{classXorpTimer}{XorpTimer} created. 
\end{DoxyReturn}
\hypertarget{classTimerList_aae6a9b14ec3fa97522a2953ff97b0e46}{
\index{TimerList@{TimerList}!set\_\-flag\_\-after@{set\_\-flag\_\-after}}
\index{set\_\-flag\_\-after@{set\_\-flag\_\-after}!TimerList@{TimerList}}
\subsubsection[{set\_\-flag\_\-after}]{\setlength{\rightskip}{0pt plus 5cm}{\bf XorpTimer} TimerList::set\_\-flag\_\-after (
\begin{DoxyParamCaption}
\item[{const {\bf TimeVal} \&}]{wait, }
\item[{bool $\ast$}]{flag\_\-ptr, }
\item[{bool}]{to\_\-value = {\ttfamily true}, }
\item[{int}]{priority = {\ttfamily XorpTask::PRIORITY\_\-DEFAULT}}
\end{DoxyParamCaption}
)}}
\label{classTimerList_aae6a9b14ec3fa97522a2953ff97b0e46}


Create a \hyperlink{classXorpTimer}{XorpTimer} to set a flag. 


\begin{DoxyParams}{Parameters}
{\em wait} & \hyperlink{protocolthe-p}{the} relative time when \hyperlink{protocolthe-p}{the} timer expires.\\
\hline
{\em flag\_\-ptr} & pointer to a boolean variable that is set to to\_\-value when \hyperlink{protocolthe-p}{the} \hyperlink{classXorpTimer}{XorpTimer} expires.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} \hyperlink{classXorpTimer}{XorpTimer} created. 
\end{DoxyReturn}
\hypertarget{classTimerList_abed920df1c070a70188335c8cf9f6cab}{
\index{TimerList@{TimerList}!set\_\-flag\_\-at@{set\_\-flag\_\-at}}
\index{set\_\-flag\_\-at@{set\_\-flag\_\-at}!TimerList@{TimerList}}
\subsubsection[{set\_\-flag\_\-at}]{\setlength{\rightskip}{0pt plus 5cm}{\bf XorpTimer} TimerList::set\_\-flag\_\-at (
\begin{DoxyParamCaption}
\item[{const {\bf TimeVal} \&}]{when, }
\item[{bool $\ast$}]{flag\_\-ptr, }
\item[{bool}]{to\_\-value = {\ttfamily true}, }
\item[{int}]{priority = {\ttfamily XorpTask::PRIORITY\_\-DEFAULT}}
\end{DoxyParamCaption}
)}}
\label{classTimerList_abed920df1c070a70188335c8cf9f6cab}


Create a \hyperlink{classXorpTimer}{XorpTimer} to set a flag. 


\begin{DoxyParams}{Parameters}
{\em when} & \hyperlink{protocolthe-p}{the} absolute time when \hyperlink{protocolthe-p}{the} timer expires.\\
\hline
{\em flag\_\-ptr} & pointer to a boolean variable that is set to to\_\-value when \hyperlink{protocolthe-p}{the} \hyperlink{classXorpTimer}{XorpTimer} expires.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} \hyperlink{classXorpTimer}{XorpTimer} created. 
\end{DoxyReturn}
\hypertarget{classTimerList_a7ddf4333a6f37174de429433fbf76a9e}{
\index{TimerList@{TimerList}!set\_\-observer@{set\_\-observer}}
\index{set\_\-observer@{set\_\-observer}!TimerList@{TimerList}}
\subsubsection[{set\_\-observer}]{\setlength{\rightskip}{0pt plus 5cm}void TimerList::set\_\-observer (
\begin{DoxyParamCaption}
\item[{{\bf TimerListObserverBase} \&}]{obs}
\end{DoxyParamCaption}
)}}
\label{classTimerList_a7ddf4333a6f37174de429433fbf76a9e}


Register an observer object with this class. 


\begin{DoxyParams}{Parameters}
{\em obs} & an observer object derived from \hyperlink{classTimerListObserverBase}{TimerListObserverBase} \\
\hline
\end{DoxyParams}
\hypertarget{classTimerList_a07e71ad79a14c3fe8dc9e38bc3134f24}{
\index{TimerList@{TimerList}!size@{size}}
\index{size@{size}!TimerList@{TimerList}}
\subsubsection[{size}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t TimerList::size (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classTimerList_a07e71ad79a14c3fe8dc9e38bc3134f24}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} number of scheduled objects. 
\end{DoxyReturn}
\hypertarget{classTimerList_a141ad0617906c67e660cd4ecbf081410}{
\index{TimerList@{TimerList}!system\_\-gettimeofday@{system\_\-gettimeofday}}
\index{system\_\-gettimeofday@{system\_\-gettimeofday}!TimerList@{TimerList}}
\subsubsection[{system\_\-gettimeofday}]{\setlength{\rightskip}{0pt plus 5cm}void TimerList::system\_\-gettimeofday (
\begin{DoxyParamCaption}
\item[{{\bf TimeVal} $\ast$}]{tv}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}static\mbox{]}}}}
\label{classTimerList_a141ad0617906c67e660cd4ecbf081410}


Default time querier. 

Get \hyperlink{protocolthe-p}{the} current time. This method is analogous to calling \hyperlink{protocolthe-p}{the} underlying operating system's 'get current system time' function and is implemented as a call to \hyperlink{classTimerList_aec05eab804a8bae7fc33937cfc56d5c4}{advance\_\-time()} followed by a call to \hyperlink{classTimerList_afc529234756c9d4fcabf489e67a5cd4f}{current\_\-time()}.


\begin{DoxyParams}{Parameters}
{\em tv} & a pointer to \hyperlink{protocolthe-p}{the} \hyperlink{classTimeVal}{TimeVal} storage to store \hyperlink{protocolthe-p}{the} current time. \\
\hline
\end{DoxyParams}
\hypertarget{classTimerList_ad60ada0ae8b594d7f431a983391841c4}{
\index{TimerList@{TimerList}!system\_\-sleep@{system\_\-sleep}}
\index{system\_\-sleep@{system\_\-sleep}!TimerList@{TimerList}}
\subsubsection[{system\_\-sleep}]{\setlength{\rightskip}{0pt plus 5cm}void TimerList::system\_\-sleep (
\begin{DoxyParamCaption}
\item[{const {\bf TimeVal} \&}]{tv}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}static\mbox{]}}}}
\label{classTimerList_ad60ada0ae8b594d7f431a983391841c4}


Suspend process execution for a defined interval. 

This methid is analogous to calling sleep(3) or usleep(3), and is implemented as a call to sleep(3) and/or usleep(3) followed by a call to \hyperlink{classTimerList_aec05eab804a8bae7fc33937cfc56d5c4}{advance\_\-time()}.


\begin{DoxyParams}{Parameters}
{\em tv} & \hyperlink{protocolthe-p}{the} period of time to suspend execution. \\
\hline
\end{DoxyParams}


The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
/home/greearb/git/xorp.ct.github/xorp/libxorp/timer.hh\item 
/home/greearb/git/xorp.ct.github/xorp/libxorp/timer.cc\end{DoxyCompactItemize}
