\section{ost::Posix\-Thread Class Reference} \label{classost_1_1_posix_thread}\index{ost::PosixThread@{ost::PosixThread}} {\tt \#include $<$thread.h$>$} Inheritance diagram for ost::Posix\-Thread::\begin{figure}[H] \begin{center} \leavevmode \includegraphics[height=2cm]{classost_1_1_posix_thread} \end{center} \end{figure} \subsection*{Public Member Functions} \begin{CompactItemize} \item {\bf Posix\-Thread} (int pri=0, size\_\-t stack=0) \item void {\bf signal\-Thread} (int signo) \begin{CompactList}\small\item\em Delivers a Posix signal to the current thread. \item\end{CompactList}\end{CompactItemize} \subsection*{Static Public Member Functions} \begin{CompactItemize} \item static void {\bf sig\-Install} (int signo) \begin{CompactList}\small\item\em Install a signal handler for use by threads and the On\-Signal() event notification handler. \item\end{CompactList}\end{CompactItemize} \subsection*{Protected Member Functions} \begin{CompactItemize} \item void {\bf signal\-Parent} ({\bf signo\_\-t} signo) \begin{CompactList}\small\item\em In the Posix version of Common C++, this can be used to send a signal into the parent thread of the current object. \item\end{CompactList}\item void {\bf signal\-Main} ({\bf signo\_\-t} signo) \begin{CompactList}\small\item\em In the Posix version of Common C++, this can be used to send a signal into the main application thread. \item\end{CompactList}\item virtual void {\bf on\-Timer} (void) \begin{CompactList}\small\item\em A derivable method to call when a SIGALRM is being delivered to a specific thread. \item\end{CompactList}\item virtual void {\bf on\-Hangup} (void) \begin{CompactList}\small\item\em A derived method to handle hangup events being delivered to a specific thread. \item\end{CompactList}\item virtual void {\bf on\-Exception} (void) \begin{CompactList}\small\item\em A derived method to call when a SIGABRT is being delivered to a specific thread. \item\end{CompactList}\item virtual void {\bf on\-Disconnect} (void) \begin{CompactList}\small\item\em A derived method to call when a SIGPIPE is being delivered to a specific thread. \item\end{CompactList}\item virtual void {\bf on\-Polling} (void) \begin{CompactList}\small\item\em A derived method to handle asynchronous I/O requests delivered to the specified thread. \item\end{CompactList}\item virtual void {\bf on\-Signal} (int) \begin{CompactList}\small\item\em A derivable method to call for delivering a signal event to a specified thread. \item\end{CompactList}\item void {\bf set\-Timer} ({\bf timeout\_\-t} timer, bool periodic=false) \begin{CompactList}\small\item\em Used to specify a timeout event that can be delivered to the current thread via SIGALRM. \item\end{CompactList}\item {\bf timeout\_\-t} {\bf get\-Timer} (void) const \begin{CompactList}\small\item\em Gets the time remaining for the current threads timer before it expires. \item\end{CompactList}\item void {\bf end\-Timer} (void) \begin{CompactList}\small\item\em Terminates the timer before the timeout period has expired. \item\end{CompactList}\item void {\bf set\-Signal} (int signo, bool active) \begin{CompactList}\small\item\em Used to enable or disable a signal within the current thread. \item\end{CompactList}\item pthread\_\-attr\_\-t $\ast$ {\bf get\-Pthread\-Attr\-Ptr} (void) \begin{CompactList}\small\item\em Access to pthread\_\-attr structure this allows setting/modifying pthread attributes not covered in the platform independant {\bf Thread}{\rm (p.\,\pageref{classost_1_1_thread})} constructor, e.g. \item\end{CompactList}\item pthread\_\-t {\bf get\-Pthread\-Id} (void) \begin{CompactList}\small\item\em Get pthread\_\-t of underlying posix thread (useful for debugging/logging). \item\end{CompactList}\end{CompactItemize} \subsection*{Friends} \begin{CompactItemize} \item class {\bf Thread\-Impl} \item class {\bf Thread} \end{CompactItemize} \subsection{Constructor \& Destructor Documentation} \index{ost::PosixThread@{ost::Posix\-Thread}!PosixThread@{PosixThread}} \index{PosixThread@{PosixThread}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Posix\-Thread::Posix\-Thread (int {\em pri} = {\tt 0}, size\_\-t {\em stack} = {\tt 0})}\label{classost_1_1_posix_thread_eeba18c7e3ef9f718b20b7477e602735} \subsection{Member Function Documentation} \index{ost::PosixThread@{ost::Posix\-Thread}!endTimer@{endTimer}} \index{endTimer@{endTimer}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Posix\-Thread::end\-Timer (void)\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_posix_thread_ed0f4cae60e5694960260d13664c1367} Terminates the timer before the timeout period has expired. This prevents the timer from sending it's SIGALRM and makes the timer available to other threads. \index{ost::PosixThread@{ost::Posix\-Thread}!getPthreadAttrPtr@{getPthreadAttrPtr}} \index{getPthreadAttrPtr@{getPthreadAttrPtr}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}pthread\_\-attr\_\-t$\ast$ ost::Posix\-Thread::get\-Pthread\-Attr\-Ptr (void)\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_posix_thread_e7b26aaccd916f0905a30707d7ef4067} Access to pthread\_\-attr structure this allows setting/modifying pthread attributes not covered in the platform independant {\bf Thread}{\rm (p.\,\pageref{classost_1_1_thread})} constructor, e.g. contention scope or scheduling policy \index{ost::PosixThread@{ost::Posix\-Thread}!getPthreadId@{getPthreadId}} \index{getPthreadId@{getPthreadId}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}pthread\_\-t ost::Posix\-Thread::get\-Pthread\-Id (void)\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_posix_thread_f114ce4574592143ef016dd9cd2bd11d} Get pthread\_\-t of underlying posix thread (useful for debugging/logging). \index{ost::PosixThread@{ost::Posix\-Thread}!getTimer@{getTimer}} \index{getTimer@{getTimer}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf timeout\_\-t} ost::Posix\-Thread::get\-Timer (void) const\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_posix_thread_79beb0fde40ee5073fe6468de94eef05} Gets the time remaining for the current threads timer before it expires. \begin{Desc} \item[Returns:]time remaining before timer expires in milliseconds. \end{Desc} \index{ost::PosixThread@{ost::Posix\-Thread}!onDisconnect@{onDisconnect}} \index{onDisconnect@{onDisconnect}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Posix\-Thread::on\-Disconnect (void)\hspace{0.3cm}{\tt [protected, virtual]}}\label{classost_1_1_posix_thread_105a9f61fcdf62acd3d5563f5d9e3905} A derived method to call when a SIGPIPE is being delivered to a specific thread. \index{ost::PosixThread@{ost::Posix\-Thread}!onException@{onException}} \index{onException@{onException}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Posix\-Thread::on\-Exception (void)\hspace{0.3cm}{\tt [protected, virtual]}}\label{classost_1_1_posix_thread_db1aa6d0e6baa04c37e1a61b641414e7} A derived method to call when a SIGABRT is being delivered to a specific thread. \index{ost::PosixThread@{ost::Posix\-Thread}!onHangup@{onHangup}} \index{onHangup@{onHangup}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Posix\-Thread::on\-Hangup (void)\hspace{0.3cm}{\tt [protected, virtual]}}\label{classost_1_1_posix_thread_cfb12beb826e7895f54a5af9e6c38434} A derived method to handle hangup events being delivered to a specific thread. \index{ost::PosixThread@{ost::Posix\-Thread}!onPolling@{onPolling}} \index{onPolling@{onPolling}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Posix\-Thread::on\-Polling (void)\hspace{0.3cm}{\tt [protected, virtual]}}\label{classost_1_1_posix_thread_6e2788cfba0b31813d4cab891f7e1feb} A derived method to handle asynchronous I/O requests delivered to the specified thread. \index{ost::PosixThread@{ost::Posix\-Thread}!onSignal@{onSignal}} \index{onSignal@{onSignal}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Posix\-Thread::on\-Signal (int)\hspace{0.3cm}{\tt [protected, virtual]}}\label{classost_1_1_posix_thread_3db7c01850d939ca1bb0fdc67aeb3efa} A derivable method to call for delivering a signal event to a specified thread. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em -}]posix signal id. \end{description} \end{Desc} \index{ost::PosixThread@{ost::Posix\-Thread}!onTimer@{onTimer}} \index{onTimer@{onTimer}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Posix\-Thread::on\-Timer (void)\hspace{0.3cm}{\tt [protected, virtual]}}\label{classost_1_1_posix_thread_9ce41764e5846b94195d367a0c7c7e4e} A derivable method to call when a SIGALRM is being delivered to a specific thread. \index{ost::PosixThread@{ost::Posix\-Thread}!setSignal@{setSignal}} \index{setSignal@{setSignal}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Posix\-Thread::set\-Signal (int {\em signo}, bool {\em active})\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_posix_thread_b665136ffddf808ab652c51f9caa953c} Used to enable or disable a signal within the current thread. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em signo}]posix signal id. \item[{\em active}]set to true to enable. \end{description} \end{Desc} \index{ost::PosixThread@{ost::Posix\-Thread}!setTimer@{setTimer}} \index{setTimer@{setTimer}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Posix\-Thread::set\-Timer ({\bf timeout\_\-t} {\em timer}, bool {\em periodic} = {\tt false})\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_posix_thread_d9c8ffa69fec8c3a139fe3d7068667a0} Used to specify a timeout event that can be delivered to the current thread via SIGALRM. When the timer expires, the {\bf on\-Timer()}{\rm (p.\,\pageref{classost_1_1_posix_thread_9ce41764e5846b94195d367a0c7c7e4e})} method is called for the thread. At present, only one thread timer can be active at any given time. On some operating systems (including Linux) a timer can be active on each thread. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em timer}]timeout in milliseconds. \item[{\em periodic}]should the timer be periodic. \end{description} \end{Desc} \begin{Desc} \item[Note:]currently, periodic timers are only available on systems with a working setitimer call. \end{Desc} \index{ost::PosixThread@{ost::Posix\-Thread}!sigInstall@{sigInstall}} \index{sigInstall@{sigInstall}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}static void ost::Posix\-Thread::sig\-Install (int {\em signo})\hspace{0.3cm}{\tt [static]}}\label{classost_1_1_posix_thread_67e582aabcd65431a38ecc8cbf0af350} Install a signal handler for use by threads and the On\-Signal() event notification handler. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em signo}]posix signal id. \end{description} \end{Desc} \index{ost::PosixThread@{ost::Posix\-Thread}!signalMain@{signalMain}} \index{signalMain@{signalMain}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Posix\-Thread::signal\-Main ({\bf signo\_\-t} {\em signo})\hspace{0.3cm}{\tt [inline, protected]}}\label{classost_1_1_posix_thread_d13ab707409d229be9c5b64a0e2ec7ad} In the Posix version of Common C++, this can be used to send a signal into the main application thread. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em signo}]a posix signal id. \end{description} \end{Desc} \index{ost::PosixThread@{ost::Posix\-Thread}!signalParent@{signalParent}} \index{signalParent@{signalParent}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Posix\-Thread::signal\-Parent ({\bf signo\_\-t} {\em signo})\hspace{0.3cm}{\tt [inline, protected]}}\label{classost_1_1_posix_thread_1698de2b943084fe05849cbd42099156} In the Posix version of Common C++, this can be used to send a signal into the parent thread of the current object. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em signo}]a posix signal id. \end{description} \end{Desc} \index{ost::PosixThread@{ost::Posix\-Thread}!signalThread@{signalThread}} \index{signalThread@{signalThread}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Posix\-Thread::signal\-Thread (int {\em signo})\hspace{0.3cm}{\tt [inline]}}\label{classost_1_1_posix_thread_fa168ff1446785a43b1123703d999207} Delivers a Posix signal to the current thread. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em signo}]a posix signal id. \end{description} \end{Desc} \subsection{Friends And Related Function Documentation} \index{ost::PosixThread@{ost::Posix\-Thread}!Thread@{Thread}} \index{Thread@{Thread}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}friend class {\bf Thread}\hspace{0.3cm}{\tt [friend]}}\label{classost_1_1_posix_thread_dbc148eaddd341d7ae4d07c9e9e33bfd} \index{ost::PosixThread@{ost::Posix\-Thread}!ThreadImpl@{ThreadImpl}} \index{ThreadImpl@{ThreadImpl}!ost::PosixThread@{ost::Posix\-Thread}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}friend class Thread\-Impl\hspace{0.3cm}{\tt [friend]}}\label{classost_1_1_posix_thread_e3c1cdb20d70b22a5c0bf395614eefff} Reimplemented from {\bf ost::Thread} {\rm (p.\,\pageref{classost_1_1_thread_e3c1cdb20d70b22a5c0bf395614eefff})}. The documentation for this class was generated from the following file:\begin{CompactItemize} \item {\bf thread.h}\end{CompactItemize}