| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 |
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> |
| 3 |
<title>PEAK Library: Task common</title> |
| 4 |
<link href="doxygen.css" rel="stylesheet" type="text/css"> |
| 5 |
</head><body> |
| 6 |
<!-- Generated by Doxygen 1.3.5 --> |
| 7 |
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="functions.html">Data Fields</a></div> |
| 8 |
<h1>Task common<br> |
| 9 |
<small> |
| 10 |
[<a class="el" href="group__task.html">Task</a>]</small> |
| 11 |
</h1><hr><a name="_details"></a><h2>Detailed Description</h2> |
| 12 |
Task common stuffs. |
| 13 |
<p> |
| 14 |
<table border=0 cellpadding=0 cellspacing=0> |
| 15 |
<tr><td></td></tr> |
| 16 |
<tr><td colspan=2><br><h2>Typedefs</h2></td></tr> |
| 17 |
<tr><td class="memItemLeft" nowrap align=right valign=top>typedef __peak_task * </td><td class="memItemRight" valign=bottom><a class="el" href="group__task__common.html#ga0">peak_task</a></td></tr> |
| 18 |
|
| 19 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Opaque task type. <a href="#ga0"></a><br><br></td></tr> |
| 20 |
<tr><td class="memItemLeft" nowrap align=right valign=top>typedef enum <a class="el" href="group__task__common.html#ga10">_peak_task_flavor_e</a> </td><td class="memItemRight" valign=bottom><a class="el" href="group__task__common.html#ga1">peak_task_flavor_t</a></td></tr> |
| 21 |
|
| 22 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Task info's flavors. <a href="#ga1"></a><br><br></td></tr> |
| 23 |
<tr><td colspan=2><br><h2>Enumerations</h2></td></tr> |
| 24 |
<tr><td class="memItemLeft" nowrap align=right valign=top>enum </td><td class="memItemRight" valign=bottom><a class="el" href="group__task__common.html#ga10">_peak_task_flavor_e</a> { <br> |
| 25 |
<a class="el" href="group__task__common.html#gga10a2">PEAK_TASK_FLAVOR_NTHREADS</a>, |
| 26 |
<br> |
| 27 |
<a class="el" href="group__task__common.html#gga10a3">PEAK_TASK_FLAVOR_MAXFDS</a> |
| 28 |
<br> |
| 29 |
}</td></tr> |
| 30 |
|
| 31 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Task info's flavors. <a href="#ga10">More...</a><br><br></td></tr> |
| 32 |
<tr><td colspan=2><br><h2>Functions</h2></td></tr> |
| 33 |
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="group__task__common.html#ga0">peak_task</a> </td><td class="memItemRight" valign=bottom><a class="el" href="group__task__common.html#ga4">peak_task_self</a> (void)</td></tr> |
| 34 |
|
| 35 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the owning task of the current execution stream. <a href="#ga4"></a><br><br></td></tr> |
| 36 |
<tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="group__task__common.html#ga5">peak_task_get_info</a> (<a class="el" href="group__task__common.html#ga0">peak_task</a> task, <a class="el" href="group__task__common.html#ga1">peak_task_flavor_t</a> flavor, int *info)</td></tr> |
| 37 |
|
| 38 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get task information. <a href="#ga5"></a><br><br></td></tr> |
| 39 |
<tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="group__task__common.html#ga6">peak_task_set_info</a> (<a class="el" href="group__task__common.html#ga0">peak_task</a> task, <a class="el" href="group__task__common.html#ga1">peak_task_flavor_t</a> flavor, int *info)</td></tr> |
| 40 |
|
| 41 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set task information. <a href="#ga6"></a><br><br></td></tr> |
| 42 |
<tr><td class="memItemLeft" nowrap align=right valign=top>const char * </td><td class="memItemRight" valign=bottom><a class="el" href="group__task__common.html#ga7">peak_task_get_engine_name</a> (<a class="el" href="group__task__common.html#ga0">peak_task</a> task)</td></tr> |
| 43 |
|
| 44 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get task's underlying engine name. <a href="#ga7"></a><br><br></td></tr> |
| 45 |
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="group__task__common.html#ga8">peak_task_run</a> (<a class="el" href="group__task__common.html#ga0">peak_task</a> task)</td></tr> |
| 46 |
|
| 47 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Enter and process the event loop. <a href="#ga8"></a><br><br></td></tr> |
| 48 |
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="group__task__common.html#ga9">peak_task_break</a> (<a class="el" href="group__task__common.html#ga0">peak_task</a> task)</td></tr> |
| 49 |
|
| 50 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Terminate task's event loop. <a href="#ga9"></a><br><br></td></tr> |
| 51 |
</table> |
| 52 |
<hr><h2>Typedef Documentation</h2> |
| 53 |
<a class="anchor" name="ga0" doxytag="task.h::peak_task" ></a><p> |
| 54 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 55 |
<tr> |
| 56 |
<td class="mdRow"> |
| 57 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 58 |
<tr> |
| 59 |
<td class="md" nowrap valign="top"> typedef struct __peak_task* <a class="el" href="group__task__common.html#ga0">peak_task</a> |
| 60 |
</table> |
| 61 |
</td> |
| 62 |
</tr> |
| 63 |
</table> |
| 64 |
<table cellspacing=5 cellpadding=0 border=0> |
| 65 |
<tr> |
| 66 |
<td> |
| 67 |
|
| 68 |
</td> |
| 69 |
<td> |
| 70 |
|
| 71 |
<p> |
| 72 |
Opaque task type. |
| 73 |
<p> |
| 74 |
One task to rule them all... </td> |
| 75 |
</tr> |
| 76 |
</table> |
| 77 |
<a class="anchor" name="ga1" doxytag="task.h::peak_task_flavor_t" ></a><p> |
| 78 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 79 |
<tr> |
| 80 |
<td class="mdRow"> |
| 81 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 82 |
<tr> |
| 83 |
<td class="md" nowrap valign="top"> typedef enum <a class="el" href="group__task__common.html#ga10">_peak_task_flavor_e</a> <a class="el" href="group__task__common.html#ga1">peak_task_flavor_t</a> |
| 84 |
</table> |
| 85 |
</td> |
| 86 |
</tr> |
| 87 |
</table> |
| 88 |
<table cellspacing=5 cellpadding=0 border=0> |
| 89 |
<tr> |
| 90 |
<td> |
| 91 |
|
| 92 |
</td> |
| 93 |
<td> |
| 94 |
|
| 95 |
<p> |
| 96 |
Task info's flavors. |
| 97 |
<p> |
| 98 |
See the documentation for the enumeration <a class="el" href="group__task__common.html#ga10">_peak_task_flavor_e</a>. </td> |
| 99 |
</tr> |
| 100 |
</table> |
| 101 |
<hr><h2>Enumeration Type Documentation</h2> |
| 102 |
<a class="anchor" name="ga10" doxytag="task.h::_peak_task_flavor_e" ></a><p> |
| 103 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 104 |
<tr> |
| 105 |
<td class="mdRow"> |
| 106 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 107 |
<tr> |
| 108 |
<td class="md" nowrap valign="top"> enum <a class="el" href="group__task__common.html#ga10">_peak_task_flavor_e</a> |
| 109 |
</table> |
| 110 |
</td> |
| 111 |
</tr> |
| 112 |
</table> |
| 113 |
<table cellspacing=5 cellpadding=0 border=0> |
| 114 |
<tr> |
| 115 |
<td> |
| 116 |
|
| 117 |
</td> |
| 118 |
<td> |
| 119 |
|
| 120 |
<p> |
| 121 |
Task info's flavors. |
| 122 |
<p> |
| 123 |
<dl compact><dt><b>Enumeration values: </b></dt><dd> |
| 124 |
<table border=0 cellspacing=2 cellpadding=0> |
| 125 |
<tr><td valign=top><em><a class="anchor" name="gga10a2" doxytag="PEAK_TASK_FLAVOR_NTHREADS" ></a>PEAK_TASK_FLAVOR_NTHREADS</em> </td><td> |
| 126 |
Specify the number of threads a task should run. |
| 127 |
<p> |
| 128 |
<dl compact><dt><b>Info's value</b></dt><dd></dd></dl> |
| 129 |
Use 0 for automatic detection which depends on the number of available CPUs when you *run* the application. </td></tr> |
| 130 |
<tr><td valign=top><em><a class="anchor" name="gga10a3" doxytag="PEAK_TASK_FLAVOR_MAXFDS" ></a>PEAK_TASK_FLAVOR_MAXFDS</em> </td><td> |
| 131 |
Specify the max number of open files allowed. |
| 132 |
<p> |
| 133 |
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.<p> |
| 134 |
<dl compact><dt><b>Info's value</b></dt><dd></dd></dl> |
| 135 |
Use 0 to set the default specified at the library compile time (usually 256). </td></tr> |
| 136 |
</table> |
| 137 |
</dl> |
| 138 |
</td> |
| 139 |
</tr> |
| 140 |
</table> |
| 141 |
<hr><h2>Function Documentation</h2> |
| 142 |
<a class="anchor" name="ga9" doxytag="task.h::peak_task_break" ></a><p> |
| 143 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 144 |
<tr> |
| 145 |
<td class="mdRow"> |
| 146 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 147 |
<tr> |
| 148 |
<td class="md" nowrap valign="top"> void peak_task_break </td> |
| 149 |
<td class="md" valign="top">( </td> |
| 150 |
<td class="md" nowrap valign="top"><a class="el" href="group__task__common.html#ga0">peak_task</a> </td> |
| 151 |
<td class="mdname1" valign="top" nowrap> <em>task</em> </td> |
| 152 |
<td class="md" valign="top"> ) </td> |
| 153 |
<td class="md" nowrap></td> |
| 154 |
</tr> |
| 155 |
|
| 156 |
</table> |
| 157 |
</td> |
| 158 |
</tr> |
| 159 |
</table> |
| 160 |
<table cellspacing=5 cellpadding=0 border=0> |
| 161 |
<tr> |
| 162 |
<td> |
| 163 |
|
| 164 |
</td> |
| 165 |
<td> |
| 166 |
|
| 167 |
<p> |
| 168 |
Terminate task's event loop. |
| 169 |
<p> |
| 170 |
This is done asynchronously: the engine waits for events being currently processed and the blocked <a class="el" href="group__task__common.html#ga19">peak_task_run()</a> exits.<p> |
| 171 |
<dl compact><dt><b>Parameters:</b></dt><dd> |
| 172 |
<table border="0" cellspacing="2" cellpadding="0"> |
| 173 |
<tr><td valign=top><em>task</em> </td><td>The task to break (usually <a class="el" href="group__task__common.html#ga8">peak_task_self()</a>). </td></tr> |
| 174 |
</table> |
| 175 |
</dl> |
| 176 |
</td> |
| 177 |
</tr> |
| 178 |
</table> |
| 179 |
<a class="anchor" name="ga7" doxytag="task.h::peak_task_get_engine_name" ></a><p> |
| 180 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 181 |
<tr> |
| 182 |
<td class="mdRow"> |
| 183 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 184 |
<tr> |
| 185 |
<td class="md" nowrap valign="top"> const char* peak_task_get_engine_name </td> |
| 186 |
<td class="md" valign="top">( </td> |
| 187 |
<td class="md" nowrap valign="top"><a class="el" href="group__task__common.html#ga0">peak_task</a> </td> |
| 188 |
<td class="mdname1" valign="top" nowrap> <em>task</em> </td> |
| 189 |
<td class="md" valign="top"> ) </td> |
| 190 |
<td class="md" nowrap></td> |
| 191 |
</tr> |
| 192 |
|
| 193 |
</table> |
| 194 |
</td> |
| 195 |
</tr> |
| 196 |
</table> |
| 197 |
<table cellspacing=5 cellpadding=0 border=0> |
| 198 |
<tr> |
| 199 |
<td> |
| 200 |
|
| 201 |
</td> |
| 202 |
<td> |
| 203 |
|
| 204 |
<p> |
| 205 |
Get task's underlying engine name. |
| 206 |
<p> |
| 207 |
<dl compact><dt><b>Parameters:</b></dt><dd> |
| 208 |
<table border="0" cellspacing="2" cellpadding="0"> |
| 209 |
<tr><td valign=top><em>task</em> </td><td>The task reference.</td></tr> |
| 210 |
</table> |
| 211 |
</dl> |
| 212 |
<dl compact><dt><b>Returns:</b></dt><dd>A pointer to the name of engine (constant). </dd></dl> |
| 213 |
</td> |
| 214 |
</tr> |
| 215 |
</table> |
| 216 |
<a class="anchor" name="ga5" doxytag="task.h::peak_task_get_info" ></a><p> |
| 217 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 218 |
<tr> |
| 219 |
<td class="mdRow"> |
| 220 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 221 |
<tr> |
| 222 |
<td class="md" nowrap valign="top"> int peak_task_get_info </td> |
| 223 |
<td class="md" valign="top">( </td> |
| 224 |
<td class="md" nowrap valign="top"><a class="el" href="group__task__common.html#ga0">peak_task</a> </td> |
| 225 |
<td class="mdname" nowrap> <em>task</em>, </td> |
| 226 |
</tr> |
| 227 |
<tr> |
| 228 |
<td></td> |
| 229 |
<td></td> |
| 230 |
<td class="md" nowrap><a class="el" href="group__task__common.html#ga1">peak_task_flavor_t</a> </td> |
| 231 |
<td class="mdname" nowrap> <em>flavor</em>, </td> |
| 232 |
</tr> |
| 233 |
<tr> |
| 234 |
<td></td> |
| 235 |
<td></td> |
| 236 |
<td class="md" nowrap>int * </td> |
| 237 |
<td class="mdname" nowrap> <em>info</em></td> |
| 238 |
</tr> |
| 239 |
<tr> |
| 240 |
<td></td> |
| 241 |
<td class="md">) </td> |
| 242 |
<td class="md" colspan="2"></td> |
| 243 |
</tr> |
| 244 |
|
| 245 |
</table> |
| 246 |
</td> |
| 247 |
</tr> |
| 248 |
</table> |
| 249 |
<table cellspacing=5 cellpadding=0 border=0> |
| 250 |
<tr> |
| 251 |
<td> |
| 252 |
|
| 253 |
</td> |
| 254 |
<td> |
| 255 |
|
| 256 |
<p> |
| 257 |
Get task information. |
| 258 |
<p> |
| 259 |
<dl compact><dt><b>Parameters:</b></dt><dd> |
| 260 |
<table border="0" cellspacing="2" cellpadding="0"> |
| 261 |
<tr><td valign=top><em>task</em> </td><td>The task reference. </td></tr> |
| 262 |
<tr><td valign=top><em>flavor</em> </td><td>One of the available flavor. </td></tr> |
| 263 |
<tr><td valign=top><em>info</em> </td><td>A pointer to a varying array of int, depending on the flavor. You must properly allocate it.</td></tr> |
| 264 |
</table> |
| 265 |
</dl> |
| 266 |
<dl compact><dt><b>Returns:</b></dt><dd>0 if successful </dd></dl> |
| 267 |
</td> |
| 268 |
</tr> |
| 269 |
</table> |
| 270 |
<a class="anchor" name="ga8" doxytag="task.h::peak_task_run" ></a><p> |
| 271 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 272 |
<tr> |
| 273 |
<td class="mdRow"> |
| 274 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 275 |
<tr> |
| 276 |
<td class="md" nowrap valign="top"> void peak_task_run </td> |
| 277 |
<td class="md" valign="top">( </td> |
| 278 |
<td class="md" nowrap valign="top"><a class="el" href="group__task__common.html#ga0">peak_task</a> </td> |
| 279 |
<td class="mdname1" valign="top" nowrap> <em>task</em> </td> |
| 280 |
<td class="md" valign="top"> ) </td> |
| 281 |
<td class="md" nowrap></td> |
| 282 |
</tr> |
| 283 |
|
| 284 |
</table> |
| 285 |
</td> |
| 286 |
</tr> |
| 287 |
</table> |
| 288 |
<table cellspacing=5 cellpadding=0 border=0> |
| 289 |
<tr> |
| 290 |
<td> |
| 291 |
|
| 292 |
</td> |
| 293 |
<td> |
| 294 |
|
| 295 |
<p> |
| 296 |
Enter and process the event loop. |
| 297 |
<p> |
| 298 |
Block the task's master thread if no event to process nor timers to fire are found. If called with <a class="el" href="group__task__common.html#ga8">peak_task_self()</a>, blocks the current thread and use it as the master thread.<br> |
| 299 |
Returns only if there is nothing to process (ie. no timer, no registered signal, no object scheduled) or after a call to <a class="el" href="group__task__common.html#ga20">peak_task_break()</a>.<br> |
| 300 |
Usually called once at the beginning (after initializations).<p> |
| 301 |
<dl compact><dt><b>Parameters:</b></dt><dd> |
| 302 |
<table border="0" cellspacing="2" cellpadding="0"> |
| 303 |
<tr><td valign=top><em>task</em> </td><td>The task to run (usually <a class="el" href="group__task__common.html#ga8">peak_task_self()</a>). </td></tr> |
| 304 |
</table> |
| 305 |
</dl> |
| 306 |
</td> |
| 307 |
</tr> |
| 308 |
</table> |
| 309 |
<a class="anchor" name="ga4" doxytag="task.h::peak_task_self" ></a><p> |
| 310 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 311 |
<tr> |
| 312 |
<td class="mdRow"> |
| 313 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 314 |
<tr> |
| 315 |
<td class="md" nowrap valign="top"> <a class="el" href="group__task__common.html#ga0">peak_task</a> peak_task_self </td> |
| 316 |
<td class="md" valign="top">( </td> |
| 317 |
<td class="md" nowrap valign="top">void </td> |
| 318 |
<td class="mdname1" valign="top" nowrap> </td> |
| 319 |
<td class="md" valign="top"> ) </td> |
| 320 |
<td class="md" nowrap></td> |
| 321 |
</tr> |
| 322 |
|
| 323 |
</table> |
| 324 |
</td> |
| 325 |
</tr> |
| 326 |
</table> |
| 327 |
<table cellspacing=5 cellpadding=0 border=0> |
| 328 |
<tr> |
| 329 |
<td> |
| 330 |
|
| 331 |
</td> |
| 332 |
<td> |
| 333 |
|
| 334 |
<p> |
| 335 |
Get the owning task of the current execution stream. |
| 336 |
<p> |
| 337 |
A task can have several threads, but this function will reference the same task in all of them. </td> |
| 338 |
</tr> |
| 339 |
</table> |
| 340 |
<a class="anchor" name="ga6" doxytag="task.h::peak_task_set_info" ></a><p> |
| 341 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 342 |
<tr> |
| 343 |
<td class="mdRow"> |
| 344 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 345 |
<tr> |
| 346 |
<td class="md" nowrap valign="top"> int peak_task_set_info </td> |
| 347 |
<td class="md" valign="top">( </td> |
| 348 |
<td class="md" nowrap valign="top"><a class="el" href="group__task__common.html#ga0">peak_task</a> </td> |
| 349 |
<td class="mdname" nowrap> <em>task</em>, </td> |
| 350 |
</tr> |
| 351 |
<tr> |
| 352 |
<td></td> |
| 353 |
<td></td> |
| 354 |
<td class="md" nowrap><a class="el" href="group__task__common.html#ga1">peak_task_flavor_t</a> </td> |
| 355 |
<td class="mdname" nowrap> <em>flavor</em>, </td> |
| 356 |
</tr> |
| 357 |
<tr> |
| 358 |
<td></td> |
| 359 |
<td></td> |
| 360 |
<td class="md" nowrap>int * </td> |
| 361 |
<td class="mdname" nowrap> <em>info</em></td> |
| 362 |
</tr> |
| 363 |
<tr> |
| 364 |
<td></td> |
| 365 |
<td class="md">) </td> |
| 366 |
<td class="md" colspan="2"></td> |
| 367 |
</tr> |
| 368 |
|
| 369 |
</table> |
| 370 |
</td> |
| 371 |
</tr> |
| 372 |
</table> |
| 373 |
<table cellspacing=5 cellpadding=0 border=0> |
| 374 |
<tr> |
| 375 |
<td> |
| 376 |
|
| 377 |
</td> |
| 378 |
<td> |
| 379 |
|
| 380 |
<p> |
| 381 |
Set task information. |
| 382 |
<p> |
| 383 |
<dl compact><dt><b>Parameters:</b></dt><dd> |
| 384 |
<table border="0" cellspacing="2" cellpadding="0"> |
| 385 |
<tr><td valign=top><em>task</em> </td><td>The task reference. </td></tr> |
| 386 |
<tr><td valign=top><em>flavor</em> </td><td>One of the available flavor. </td></tr> |
| 387 |
<tr><td valign=top><em>info</em> </td><td>A pointer to a varying array of int, depending on the flavor, containing the value you want to set.</td></tr> |
| 388 |
</table> |
| 389 |
</dl> |
| 390 |
<dl compact><dt><b>Returns:</b></dt><dd>0 if successful </dd></dl> |
| 391 |
</td> |
| 392 |
</tr> |
| 393 |
</table> |
| 394 |
<hr size="1"><address style="align: right;"><small>Generated on Sat Jan 17 21:41:54 2004 for the PEAK Library by |
| 395 |
<a href="http://www.doxygen.org/index.html"> |
| 396 |
<img src="doxygen.png" alt="doxygen" align="middle" border="0" > |
| 397 |
</a></small> <a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=98146&type=1" width="88" height="31" align="middle" border="0" alt="SourceForge.net Logo" /></a></address> |
| 398 |
</body> |
| 399 |
</html> |
| 400 |
|