diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-08-14 23:43:53 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-08-14 23:43:53 +0000 |
commit | 0c7015a6d8d2b3bf021c216b24d7062cd7375a71 (patch) | |
tree | 18bddea280e5e85d09389e9275c5efd15f17c840 /src/include/gnunet_scheduler_lib.h | |
parent | ca173048a26a418866163d14c9159b9ad712644b (diff) | |
download | gnunet-0c7015a6d8d2b3bf021c216b24d7062cd7375a71.tar.gz gnunet-0c7015a6d8d2b3bf021c216b24d7062cd7375a71.zip |
-playing with doxygen groups
Diffstat (limited to 'src/include/gnunet_scheduler_lib.h')
-rw-r--r-- | src/include/gnunet_scheduler_lib.h | 90 |
1 files changed, 47 insertions, 43 deletions
diff --git a/src/include/gnunet_scheduler_lib.h b/src/include/gnunet_scheduler_lib.h index c482a000c..110c0ce77 100644 --- a/src/include/gnunet_scheduler_lib.h +++ b/src/include/gnunet_scheduler_lib.h | |||
@@ -22,6 +22,8 @@ | |||
22 | * @file include/gnunet_scheduler_lib.h | 22 | * @file include/gnunet_scheduler_lib.h |
23 | * @brief API to schedule computations using continuation passing style | 23 | * @brief API to schedule computations using continuation passing style |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * @defgroup scheduler Event loop (scheduler) | ||
26 | * @{ | ||
25 | */ | 27 | */ |
26 | 28 | ||
27 | #ifndef GNUNET_SCHEDULER_LIB_H | 29 | #ifndef GNUNET_SCHEDULER_LIB_H |
@@ -198,29 +200,29 @@ typedef void (*GNUNET_SCHEDULER_Task) (void *cls, | |||
198 | 200 | ||
199 | /** | 201 | /** |
200 | * Signature of the select function used by the scheduler. | 202 | * Signature of the select function used by the scheduler. |
201 | * GNUNET_NETWORK_socket_select matches it. | 203 | * #GNUNET_NETWORK_socket_select matches it. |
202 | * | 204 | * |
203 | * @param cls closure | 205 | * @param cls closure |
204 | * @param rfds set of sockets to be checked for readability | 206 | * @param rfds set of sockets to be checked for readability |
205 | * @param wfds set of sockets to be checked for writability | 207 | * @param wfds set of sockets to be checked for writability |
206 | * @param efds set of sockets to be checked for exceptions | 208 | * @param efds set of sockets to be checked for exceptions |
207 | * @param timeout relative value when to return | 209 | * @param timeout relative value when to return |
208 | * @return number of selected sockets, GNUNET_SYSERR on error | 210 | * @return number of selected sockets, #GNUNET_SYSERR on error |
209 | */ | 211 | */ |
210 | typedef int (*GNUNET_SCHEDULER_select) (void *cls, | 212 | typedef int (*GNUNET_SCHEDULER_select) (void *cls, |
211 | struct GNUNET_NETWORK_FDSet * rfds, | 213 | struct GNUNET_NETWORK_FDSet *rfds, |
212 | struct GNUNET_NETWORK_FDSet * wfds, | 214 | struct GNUNET_NETWORK_FDSet *wfds, |
213 | struct GNUNET_NETWORK_FDSet * efds, | 215 | struct GNUNET_NETWORK_FDSet *efds, |
214 | struct GNUNET_TIME_Relative timeout); | 216 | struct GNUNET_TIME_Relative timeout); |
215 | 217 | ||
216 | 218 | ||
217 | /** | 219 | /** |
218 | * Initialize and run scheduler. This function will return when all | 220 | * Initialize and run scheduler. This function will return when all |
219 | * tasks have completed. On systems with signals, receiving a SIGTERM | 221 | * tasks have completed. On systems with signals, receiving a SIGTERM |
220 | * (and other similar signals) will cause "GNUNET_SCHEDULER_shutdown" | 222 | * (and other similar signals) will cause #GNUNET_SCHEDULER_shutdown |
221 | * to be run after the active task is complete. As a result, SIGTERM | 223 | * to be run after the active task is complete. As a result, SIGTERM |
222 | * causes all active tasks to be scheduled with reason | 224 | * causes all active tasks to be scheduled with reason |
223 | * "GNUNET_SCHEDULER_REASON_SHUTDOWN". (However, tasks added | 225 | * #GNUNET_SCHEDULER_REASON_SHUTDOWN. (However, tasks added |
224 | * afterwards will execute normally!). Note that any particular | 226 | * afterwards will execute normally!). Note that any particular |
225 | * signal will only shut down one scheduler; applications should | 227 | * signal will only shut down one scheduler; applications should |
226 | * always only create a single scheduler. | 228 | * always only create a single scheduler. |
@@ -249,7 +251,7 @@ GNUNET_SCHEDULER_shutdown (void); | |||
249 | * dropped (if the decision should be made based on the number of | 251 | * dropped (if the decision should be made based on the number of |
250 | * tasks ready to run). | 252 | * tasks ready to run). |
251 | * | 253 | * |
252 | * * @param p priority-level to query, use KEEP to query the level | 254 | * @param p priority-level to query, use KEEP to query the level |
253 | * of the current task, use COUNT to get the sum over | 255 | * of the current task, use COUNT to get the sum over |
254 | * all priority levels | 256 | * all priority levels |
255 | * @return number of tasks pending right now | 257 | * @return number of tasks pending right now |
@@ -263,7 +265,7 @@ GNUNET_SCHEDULER_get_load (enum GNUNET_SCHEDULER_Priority p); | |||
263 | * started. Will return the same value as | 265 | * started. Will return the same value as |
264 | * the GNUNET_SCHEDULER_TaskContext's reason field. | 266 | * the GNUNET_SCHEDULER_TaskContext's reason field. |
265 | * | 267 | * |
266 | * * @return reason(s) why the current task is run | 268 | * @return reason(s) why the current task is run |
267 | */ | 269 | */ |
268 | enum GNUNET_SCHEDULER_Reason | 270 | enum GNUNET_SCHEDULER_Reason |
269 | GNUNET_SCHEDULER_get_reason (void); | 271 | GNUNET_SCHEDULER_get_reason (void); |
@@ -273,7 +275,7 @@ GNUNET_SCHEDULER_get_reason (void); | |||
273 | * Cancel the task with the specified identifier. | 275 | * Cancel the task with the specified identifier. |
274 | * The task must not yet have run. | 276 | * The task must not yet have run. |
275 | * | 277 | * |
276 | * * @param task id of the task to cancel | 278 | * @param task id of the task to cancel |
277 | * @return the closure of the callback of the cancelled task | 279 | * @return the closure of the callback of the cancelled task |
278 | */ | 280 | */ |
279 | void * | 281 | void * |
@@ -285,7 +287,7 @@ GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_TaskIdentifier task); | |||
285 | * similar to the other "add" functions except that there is no delay | 287 | * similar to the other "add" functions except that there is no delay |
286 | * and the reason code can be specified. | 288 | * and the reason code can be specified. |
287 | * | 289 | * |
288 | * * @param task main function of the task | 290 | * @param task main function of the task |
289 | * @param task_cls closure of task | 291 | * @param task_cls closure of task |
290 | * @param reason reason for task invocation | 292 | * @param reason reason for task invocation |
291 | */ | 293 | */ |
@@ -300,7 +302,7 @@ GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_Task task, void *task_cls, | |||
300 | * and the reason code can be specified. | 302 | * and the reason code can be specified. |
301 | * | 303 | * |
302 | * @param task main function of the task | 304 | * @param task main function of the task |
303 | * @param task_cls closure for 'main' | 305 | * @param task_cls closure for @a task |
304 | * @param reason reason for task invocation | 306 | * @param reason reason for task invocation |
305 | * @param priority priority to use for the task | 307 | * @param priority priority to use for the task |
306 | */ | 308 | */ |
@@ -313,11 +315,11 @@ GNUNET_SCHEDULER_add_continuation_with_priority (GNUNET_SCHEDULER_Task task, voi | |||
313 | /** | 315 | /** |
314 | * Schedule a new task to be run with a specified priority. | 316 | * Schedule a new task to be run with a specified priority. |
315 | * | 317 | * |
316 | * * @param prio how important is the new task? | 318 | * @param prio how important is the new task? |
317 | * @param task main function of the task | 319 | * @param task main function of the task |
318 | * @param task_cls closure of task | 320 | * @param task_cls closure of @a task |
319 | * @return unique task identifier for the job | 321 | * @return unique task identifier for the job |
320 | * only valid until "task" is started! | 322 | * only valid until @a task is started! |
321 | */ | 323 | */ |
322 | GNUNET_SCHEDULER_TaskIdentifier | 324 | GNUNET_SCHEDULER_TaskIdentifier |
323 | GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, | 325 | GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, |
@@ -328,10 +330,10 @@ GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, | |||
328 | * Schedule a new task to be run as soon as possible. The task | 330 | * Schedule a new task to be run as soon as possible. The task |
329 | * will be run with the DEFAULT priority. | 331 | * will be run with the DEFAULT priority. |
330 | * | 332 | * |
331 | * * @param task main function of the task | 333 | * @param task main function of the task |
332 | * @param task_cls closure of task | 334 | * @param task_cls closure of @a task |
333 | * @return unique task identifier for the job | 335 | * @return unique task identifier for the job |
334 | * only valid until "task" is started! | 336 | * only valid until @a task is started! |
335 | */ | 337 | */ |
336 | GNUNET_SCHEDULER_TaskIdentifier | 338 | GNUNET_SCHEDULER_TaskIdentifier |
337 | GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_Task task, void *task_cls); | 339 | GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_Task task, void *task_cls); |
@@ -345,11 +347,11 @@ GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_Task task, void *task_cls); | |||
345 | * not count for the 'lifeness' of the process. This API is only | 347 | * not count for the 'lifeness' of the process. This API is only |
346 | * useful in a few special cases. | 348 | * useful in a few special cases. |
347 | * | 349 | * |
348 | * @param lifeness GNUNET_YES if the task counts for lifeness, GNUNET_NO if not. | 350 | * @param lifeness #GNUNET_YES if the task counts for lifeness, #GNUNET_NO if not. |
349 | * @param task main function of the task | 351 | * @param task main function of the task |
350 | * @param task_cls closure of task | 352 | * @param task_cls closure of @a task |
351 | * @return unique task identifier for the job | 353 | * @return unique task identifier for the job |
352 | * only valid until "task" is started! | 354 | * only valid until @a task is started! |
353 | */ | 355 | */ |
354 | GNUNET_SCHEDULER_TaskIdentifier | 356 | GNUNET_SCHEDULER_TaskIdentifier |
355 | GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, | 357 | GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, |
@@ -363,11 +365,11 @@ GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, | |||
363 | * will be run with the DEFAULT priority. | 365 | * will be run with the DEFAULT priority. |
364 | * | 366 | * |
365 | * * @param delay when should this operation time out? Use | 367 | * * @param delay when should this operation time out? Use |
366 | * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | 368 | * #GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" |
367 | * @param task main function of the task | 369 | * @param task main function of the task |
368 | * @param task_cls closure of task | 370 | * @param task_cls closure of @a task |
369 | * @return unique task identifier for the job | 371 | * @return unique task identifier for the job |
370 | * only valid until "task" is started! | 372 | * only valid until @a task is started! |
371 | */ | 373 | */ |
372 | GNUNET_SCHEDULER_TaskIdentifier | 374 | GNUNET_SCHEDULER_TaskIdentifier |
373 | GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, | 375 | GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, |
@@ -379,12 +381,12 @@ GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, | |||
379 | * will be scheduled for execution once the delay has expired. | 381 | * will be scheduled for execution once the delay has expired. |
380 | * | 382 | * |
381 | * @param delay when should this operation time out? Use | 383 | * @param delay when should this operation time out? Use |
382 | * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | 384 | * #GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" |
383 | * @param priority priority to use for the task | 385 | * @param priority priority to use for the task |
384 | * @param task main function of the task | 386 | * @param task main function of the task |
385 | * @param task_cls closure of task | 387 | * @param task_cls closure of @a task |
386 | * @return unique task identifier for the job | 388 | * @return unique task identifier for the job |
387 | * only valid until "task" is started! | 389 | * only valid until @a task is started! |
388 | */ | 390 | */ |
389 | GNUNET_SCHEDULER_TaskIdentifier | 391 | GNUNET_SCHEDULER_TaskIdentifier |
390 | GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay, | 392 | GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay, |
@@ -400,12 +402,12 @@ GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay, | |||
400 | * socket operation is ready. It will be run with the DEFAULT priority. | 402 | * socket operation is ready. It will be run with the DEFAULT priority. |
401 | * | 403 | * |
402 | * * @param delay when should this operation time out? Use | 404 | * * @param delay when should this operation time out? Use |
403 | * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | 405 | * #GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" |
404 | * @param rfd read file-descriptor | 406 | * @param rfd read file-descriptor |
405 | * @param task main function of the task | 407 | * @param task main function of the task |
406 | * @param task_cls closure of task | 408 | * @param task_cls closure of @a task |
407 | * @return unique task identifier for the job | 409 | * @return unique task identifier for the job |
408 | * only valid until "task" is started! | 410 | * only valid until @a task is started! |
409 | */ | 411 | */ |
410 | GNUNET_SCHEDULER_TaskIdentifier | 412 | GNUNET_SCHEDULER_TaskIdentifier |
411 | GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, | 413 | GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, |
@@ -422,13 +424,13 @@ GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, | |||
422 | * will be run with the DEFAULT priority. | 424 | * will be run with the DEFAULT priority. |
423 | * | 425 | * |
424 | * @param delay when should this operation time out? Use | 426 | * @param delay when should this operation time out? Use |
425 | * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | 427 | * #GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" |
426 | * @param priority priority to use for the task | 428 | * @param priority priority to use for the task |
427 | * @param rfd read file-descriptor | 429 | * @param rfd read file-descriptor |
428 | * @param task main function of the task | 430 | * @param task main function of the task |
429 | * @param task_cls closure of task | 431 | * @param task_cls closure of @a task |
430 | * @return unique task identifier for the job | 432 | * @return unique task identifier for the job |
431 | * only valid until "task" is started! | 433 | * only valid until @a task is started! |
432 | */ | 434 | */ |
433 | GNUNET_SCHEDULER_TaskIdentifier | 435 | GNUNET_SCHEDULER_TaskIdentifier |
434 | GNUNET_SCHEDULER_add_read_net_with_priority (struct GNUNET_TIME_Relative delay, | 436 | GNUNET_SCHEDULER_add_read_net_with_priority (struct GNUNET_TIME_Relative delay, |
@@ -445,12 +447,12 @@ GNUNET_SCHEDULER_add_read_net_with_priority (struct GNUNET_TIME_Relative delay, | |||
445 | * socket operation is ready. It will be run with the DEFAULT priority. | 447 | * socket operation is ready. It will be run with the DEFAULT priority. |
446 | * | 448 | * |
447 | * * @param delay when should this operation time out? Use | 449 | * * @param delay when should this operation time out? Use |
448 | * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | 450 | * #GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" |
449 | * @param wfd write file-descriptor | 451 | * @param wfd write file-descriptor |
450 | * @param task main function of the task | 452 | * @param task main function of the task |
451 | * @param task_cls closure of task | 453 | * @param task_cls closure of @a task |
452 | * @return unique task identifier for the job | 454 | * @return unique task identifier for the job |
453 | * only valid until "task" is started! | 455 | * only valid until @a task is started! |
454 | */ | 456 | */ |
455 | GNUNET_SCHEDULER_TaskIdentifier | 457 | GNUNET_SCHEDULER_TaskIdentifier |
456 | GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, | 458 | GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, |
@@ -466,10 +468,10 @@ GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, | |||
466 | * socket operation is ready. It will be run with the DEFAULT priority. | 468 | * socket operation is ready. It will be run with the DEFAULT priority. |
467 | * | 469 | * |
468 | * * @param delay when should this operation time out? Use | 470 | * * @param delay when should this operation time out? Use |
469 | * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | 471 | * #GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" |
470 | * @param rfd read file-descriptor | 472 | * @param rfd read file-descriptor |
471 | * @param task main function of the task | 473 | * @param task main function of the task |
472 | * @param task_cls closure of task | 474 | * @param task_cls closure of @a task |
473 | * @return unique task identifier for the job | 475 | * @return unique task identifier for the job |
474 | * only valid until "task" is started! | 476 | * only valid until "task" is started! |
475 | */ | 477 | */ |
@@ -487,12 +489,12 @@ GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay, | |||
487 | * socket operation is ready. It will be run with the DEFAULT priority. | 489 | * socket operation is ready. It will be run with the DEFAULT priority. |
488 | * | 490 | * |
489 | * * @param delay when should this operation time out? Use | 491 | * * @param delay when should this operation time out? Use |
490 | * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | 492 | * #GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" |
491 | * @param wfd write file-descriptor | 493 | * @param wfd write file-descriptor |
492 | * @param task main function of the task | 494 | * @param task main function of the task |
493 | * @param task_cls closure of task | 495 | * @param task_cls closure of @a task |
494 | * @return unique task identifier for the job | 496 | * @return unique task identifier for the job |
495 | * only valid until "task" is started! | 497 | * only valid until @a task is started! |
496 | */ | 498 | */ |
497 | GNUNET_SCHEDULER_TaskIdentifier | 499 | GNUNET_SCHEDULER_TaskIdentifier |
498 | GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay, | 500 | GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay, |
@@ -518,12 +520,12 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay, | |||
518 | * </code> | 520 | * </code> |
519 | * | 521 | * |
520 | * @param prio how important is this task? | 522 | * @param prio how important is this task? |
521 | * @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL for "forever", | 523 | * @param delay how long should we wait? Use #GNUNET_TIME_UNIT_FOREVER_REL for "forever", |
522 | * which means that the task will only be run after we receive SIGTERM | 524 | * which means that the task will only be run after we receive SIGTERM |
523 | * @param rs set of file descriptors we want to read (can be NULL) | 525 | * @param rs set of file descriptors we want to read (can be NULL) |
524 | * @param ws set of file descriptors we want to write (can be NULL) | 526 | * @param ws set of file descriptors we want to write (can be NULL) |
525 | * @param task main function of the task | 527 | * @param task main function of the task |
526 | * @param task_cls closure of task | 528 | * @param task_cls closure of @a task |
527 | * @return unique task identifier for the job | 529 | * @return unique task identifier for the job |
528 | * only valid until "task" is started! | 530 | * only valid until "task" is started! |
529 | */ | 531 | */ |
@@ -545,6 +547,8 @@ GNUNET_SCHEDULER_set_select (GNUNET_SCHEDULER_select new_select, | |||
545 | void *new_select_cls); | 547 | void *new_select_cls); |
546 | 548 | ||
547 | 549 | ||
550 | /** @} */ /* end of group scheduler */ | ||
551 | |||
548 | #if 0 /* keep Emacsens' auto-indent happy */ | 552 | #if 0 /* keep Emacsens' auto-indent happy */ |
549 | { | 553 | { |
550 | #endif | 554 | #endif |