ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/vendor/libpeak-0.1.2/doc/latex/group__task__common.tex
Revision: 3251
Committed: Wed Apr 2 16:58:30 2014 UTC (11 years, 4 months ago) by michael
Content type: text/x-tex
File size: 10428 byte(s)
Log Message:
- Imported libpeak-0.1.2

File Contents

# User Rev Content
1 michael 3251 \hypertarget{group__task__common}{
2     \section{Task common}
3     \label{group__task__common}\index{Task common@{Task common}}
4     }
5    
6    
7     \subsection{Detailed Description}
8     Task common stuffs.
9    
10     \subsection*{Typedefs}
11     \begin{CompactItemize}
12     \item
13     typedef \_\-\_\-peak\_\-task $\ast$ \hyperlink{group__task__common_ga0}{peak\_\-task}
14     \begin{CompactList}\small\item\em Opaque task type. \item\end{CompactList}\item
15     typedef enum \hyperlink{group__task__common_ga10}{\_\-peak\_\-task\_\-flavor\_\-e} \hyperlink{group__task__common_ga1}{peak\_\-task\_\-flavor\_\-t}
16     \begin{CompactList}\small\item\em Task info's flavors. \item\end{CompactList}\end{CompactItemize}
17     \subsection*{Enumerations}
18     \begin{CompactItemize}
19     \item
20     enum \hyperlink{group__task__common_ga10}{\_\-peak\_\-task\_\-flavor\_\-e} \{ \par
21     \hyperlink{group__task__common_gga10a2}{PEAK\_\-TASK\_\-FLAVOR\_\-NTHREADS},
22     \par
23     \hyperlink{group__task__common_gga10a3}{PEAK\_\-TASK\_\-FLAVOR\_\-MAXFDS}
24     \}
25     \begin{CompactList}\small\item\em Task info's flavors. \item\end{CompactList}\end{CompactItemize}
26     \subsection*{Functions}
27     \begin{CompactItemize}
28     \item
29     \hyperlink{group__task__common_ga0}{peak\_\-task} \hyperlink{group__task__common_ga4}{peak\_\-task\_\-self} (void)
30     \begin{CompactList}\small\item\em Get the owning task of the current execution stream. \item\end{CompactList}\item
31     int \hyperlink{group__task__common_ga5}{peak\_\-task\_\-get\_\-info} (\hyperlink{group__task__common_ga0}{peak\_\-task} task, \hyperlink{group__task__common_ga1}{peak\_\-task\_\-flavor\_\-t} flavor, int $\ast$info)
32     \begin{CompactList}\small\item\em Get task information. \item\end{CompactList}\item
33     int \hyperlink{group__task__common_ga6}{peak\_\-task\_\-set\_\-info} (\hyperlink{group__task__common_ga0}{peak\_\-task} task, \hyperlink{group__task__common_ga1}{peak\_\-task\_\-flavor\_\-t} flavor, int $\ast$info)
34     \begin{CompactList}\small\item\em Set task information. \item\end{CompactList}\item
35     const char $\ast$ \hyperlink{group__task__common_ga7}{peak\_\-task\_\-get\_\-engine\_\-name} (\hyperlink{group__task__common_ga0}{peak\_\-task} task)
36     \begin{CompactList}\small\item\em Get task's underlying engine name. \item\end{CompactList}\item
37     void \hyperlink{group__task__common_ga8}{peak\_\-task\_\-run} (\hyperlink{group__task__common_ga0}{peak\_\-task} task)
38     \begin{CompactList}\small\item\em Enter and process the event loop. \item\end{CompactList}\item
39     void \hyperlink{group__task__common_ga9}{peak\_\-task\_\-break} (\hyperlink{group__task__common_ga0}{peak\_\-task} task)
40     \begin{CompactList}\small\item\em Terminate task's event loop. \item\end{CompactList}\end{CompactItemize}
41    
42    
43     \subsection{Typedef Documentation}
44     \hypertarget{group__task__common_ga0}{
45     \index{task_common@{task\_\-common}!peak_task@{peak\_\-task}}
46     \index{peak_task@{peak\_\-task}!task_common@{task\_\-common}}
47     \subsubsection[peak\_\-task]{\setlength{\rightskip}{0pt plus 5cm}typedef struct \_\-\_\-peak\_\-task$\ast$ \hyperlink{group__task__common_ga0}{peak\_\-task}}}
48     \label{group__task__common_ga0}
49    
50    
51     Opaque task type.
52    
53     One task to rule them all... \hypertarget{group__task__common_ga1}{
54     \index{task_common@{task\_\-common}!peak_task_flavor_t@{peak\_\-task\_\-flavor\_\-t}}
55     \index{peak_task_flavor_t@{peak\_\-task\_\-flavor\_\-t}!task_common@{task\_\-common}}
56     \subsubsection[peak\_\-task\_\-flavor\_\-t]{\setlength{\rightskip}{0pt plus 5cm}typedef enum \hyperlink{group__task__common_ga10}{\_\-peak\_\-task\_\-flavor\_\-e} \hyperlink{group__task__common_ga1}{peak\_\-task\_\-flavor\_\-t}}}
57     \label{group__task__common_ga1}
58    
59    
60     Task info's flavors.
61    
62     See the documentation for the enumeration \hyperlink{group__task__common_ga10}{\_\-peak\_\-task\_\-flavor\_\-e}.
63    
64     \subsection{Enumeration Type Documentation}
65     \hypertarget{group__task__common_ga10}{
66     \index{task_common@{task\_\-common}!_peak_task_flavor_e@{\_\-peak\_\-task\_\-flavor\_\-e}}
67     \index{_peak_task_flavor_e@{\_\-peak\_\-task\_\-flavor\_\-e}!task_common@{task\_\-common}}
68     \subsubsection[\_\-peak\_\-task\_\-flavor\_\-e]{\setlength{\rightskip}{0pt plus 5cm}enum \hyperlink{group__task__common_ga10}{\_\-peak\_\-task\_\-flavor\_\-e}}}
69     \label{group__task__common_ga10}
70    
71    
72     Task info's flavors.
73    
74     \begin{Desc}
75     \item[Enumeration values: ]\par
76     \begin{description}
77     \index{PEAK_TASK_FLAVOR_NTHREADS@{PEAK\_\-TASK\_\-FLAVOR\_\-NTHREADS}!task_common@{task\_\-common}}\index{task_common@{task\_\-common}!PEAK_TASK_FLAVOR_NTHREADS@{PEAK\_\-TASK\_\-FLAVOR\_\-NTHREADS}}\item[{\em
78     \hypertarget{group__task__common_gga10a2}{
79     PEAK\_\-TASK\_\-FLAVOR\_\-NTHREADS}
80     \label{group__task__common_gga10a2}
81     }]Specify the number of threads a task should run.
82    
83     \begin{Desc}
84     \item[Info's value]\end{Desc}
85     Use 0 for automatic detection which depends on the number of available CPUs when you $\ast$run$\ast$ the application. \index{PEAK_TASK_FLAVOR_MAXFDS@{PEAK\_\-TASK\_\-FLAVOR\_\-MAXFDS}!task_common@{task\_\-common}}\index{task_common@{task\_\-common}!PEAK_TASK_FLAVOR_MAXFDS@{PEAK\_\-TASK\_\-FLAVOR\_\-MAXFDS}}\item[{\em
86     \hypertarget{group__task__common_gga10a3}{
87     PEAK\_\-TASK\_\-FLAVOR\_\-MAXFDS}
88     \label{group__task__common_gga10a3}
89     }]Specify the max number of open files allowed.
90    
91     This defines only the max number of open files allowed to open by the PEAK library and doesn't count application-level file descriptors. WARNING: This is not true when using the basic select() engine, due to an implementation limitation.
92    
93     \begin{Desc}
94     \item[Info's value]\end{Desc}
95     Use 0 to set the default specified at the library compile time (usually 256). \end{description}
96     \end{Desc}
97    
98    
99    
100     \subsection{Function Documentation}
101     \hypertarget{group__task__common_ga9}{
102     \index{task_common@{task\_\-common}!peak_task_break@{peak\_\-task\_\-break}}
103     \index{peak_task_break@{peak\_\-task\_\-break}!task_common@{task\_\-common}}
104     \subsubsection[peak\_\-task\_\-break]{\setlength{\rightskip}{0pt plus 5cm}void peak\_\-task\_\-break (\hyperlink{group__task__common_ga0}{peak\_\-task} {\em task})}}
105     \label{group__task__common_ga9}
106    
107    
108     Terminate task's event loop.
109    
110     This is done asynchronously: the engine waits for events being currently processed and the blocked \hyperlink{group__task__common_ga19}{peak\_\-task\_\-run()} exits.
111    
112     \begin{Desc}
113     \item[Parameters:]
114     \begin{description}
115     \item[{\em task}]The task to break (usually \hyperlink{group__task__common_ga8}{peak\_\-task\_\-self()}). \end{description}
116     \end{Desc}
117     \hypertarget{group__task__common_ga7}{
118     \index{task_common@{task\_\-common}!peak_task_get_engine_name@{peak\_\-task\_\-get\_\-engine\_\-name}}
119     \index{peak_task_get_engine_name@{peak\_\-task\_\-get\_\-engine\_\-name}!task_common@{task\_\-common}}
120     \subsubsection[peak\_\-task\_\-get\_\-engine\_\-name]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ peak\_\-task\_\-get\_\-engine\_\-name (\hyperlink{group__task__common_ga0}{peak\_\-task} {\em task})}}
121     \label{group__task__common_ga7}
122    
123    
124     Get task's underlying engine name.
125    
126     \begin{Desc}
127     \item[Parameters:]
128     \begin{description}
129     \item[{\em task}]The task reference.\end{description}
130     \end{Desc}
131     \begin{Desc}
132     \item[Returns:]A pointer to the name of engine (constant). \end{Desc}
133     \hypertarget{group__task__common_ga5}{
134     \index{task_common@{task\_\-common}!peak_task_get_info@{peak\_\-task\_\-get\_\-info}}
135     \index{peak_task_get_info@{peak\_\-task\_\-get\_\-info}!task_common@{task\_\-common}}
136     \subsubsection[peak\_\-task\_\-get\_\-info]{\setlength{\rightskip}{0pt plus 5cm}int peak\_\-task\_\-get\_\-info (\hyperlink{group__task__common_ga0}{peak\_\-task} {\em task}, \hyperlink{group__task__common_ga1}{peak\_\-task\_\-flavor\_\-t} {\em flavor}, int $\ast$ {\em info})}}
137     \label{group__task__common_ga5}
138    
139    
140     Get task information.
141    
142     \begin{Desc}
143     \item[Parameters:]
144     \begin{description}
145     \item[{\em task}]The task reference. \item[{\em flavor}]One of the available flavor. \item[{\em info}]A pointer to a varying array of int, depending on the flavor. You must properly allocate it.\end{description}
146     \end{Desc}
147     \begin{Desc}
148     \item[Returns:]0 if successful \end{Desc}
149     \hypertarget{group__task__common_ga8}{
150     \index{task_common@{task\_\-common}!peak_task_run@{peak\_\-task\_\-run}}
151     \index{peak_task_run@{peak\_\-task\_\-run}!task_common@{task\_\-common}}
152     \subsubsection[peak\_\-task\_\-run]{\setlength{\rightskip}{0pt plus 5cm}void peak\_\-task\_\-run (\hyperlink{group__task__common_ga0}{peak\_\-task} {\em task})}}
153     \label{group__task__common_ga8}
154    
155    
156     Enter and process the event loop.
157    
158     Block the task's master thread if no event to process nor timers to fire are found. If called with \hyperlink{group__task__common_ga8}{peak\_\-task\_\-self()}, blocks the current thread and use it as the master thread.\par
159     Returns only if there is nothing to process (ie. no timer, no registered signal, no object scheduled) or after a call to \hyperlink{group__task__common_ga20}{peak\_\-task\_\-break()}.\par
160     Usually called once at the beginning (after initializations).
161    
162     \begin{Desc}
163     \item[Parameters:]
164     \begin{description}
165     \item[{\em task}]The task to run (usually \hyperlink{group__task__common_ga8}{peak\_\-task\_\-self()}). \end{description}
166     \end{Desc}
167     \hypertarget{group__task__common_ga4}{
168     \index{task_common@{task\_\-common}!peak_task_self@{peak\_\-task\_\-self}}
169     \index{peak_task_self@{peak\_\-task\_\-self}!task_common@{task\_\-common}}
170     \subsubsection[peak\_\-task\_\-self]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{group__task__common_ga0}{peak\_\-task} peak\_\-task\_\-self (void)}}
171     \label{group__task__common_ga4}
172    
173    
174     Get the owning task of the current execution stream.
175    
176     A task can have several threads, but this function will reference the same task in all of them. \hypertarget{group__task__common_ga6}{
177     \index{task_common@{task\_\-common}!peak_task_set_info@{peak\_\-task\_\-set\_\-info}}
178     \index{peak_task_set_info@{peak\_\-task\_\-set\_\-info}!task_common@{task\_\-common}}
179     \subsubsection[peak\_\-task\_\-set\_\-info]{\setlength{\rightskip}{0pt plus 5cm}int peak\_\-task\_\-set\_\-info (\hyperlink{group__task__common_ga0}{peak\_\-task} {\em task}, \hyperlink{group__task__common_ga1}{peak\_\-task\_\-flavor\_\-t} {\em flavor}, int $\ast$ {\em info})}}
180     \label{group__task__common_ga6}
181    
182    
183     Set task information.
184    
185     \begin{Desc}
186     \item[Parameters:]
187     \begin{description}
188     \item[{\em task}]The task reference. \item[{\em flavor}]One of the available flavor. \item[{\em info}]A pointer to a varying array of int, depending on the flavor, containing the value you want to set.\end{description}
189     \end{Desc}
190     \begin{Desc}
191     \item[Returns:]0 if successful \end{Desc}