diff options
Diffstat (limited to 'src/include/gnunet_scheduler_lib.h')
-rw-r--r-- | src/include/gnunet_scheduler_lib.h | 136 |
1 files changed, 51 insertions, 85 deletions
diff --git a/src/include/gnunet_scheduler_lib.h b/src/include/gnunet_scheduler_lib.h index 9ab3a3a84..0f80b9cee 100644 --- a/src/include/gnunet_scheduler_lib.h +++ b/src/include/gnunet_scheduler_lib.h | |||
@@ -224,7 +224,8 @@ typedef int (*GNUNET_SCHEDULER_select) (void *cls, | |||
224 | * @param task task to run first (and immediately) | 224 | * @param task task to run first (and immediately) |
225 | * @param task_cls closure of task | 225 | * @param task_cls closure of task |
226 | */ | 226 | */ |
227 | void GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls); | 227 | void |
228 | GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls); | ||
228 | 229 | ||
229 | 230 | ||
230 | /** | 231 | /** |
@@ -234,7 +235,8 @@ void GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls); | |||
234 | * priorities and prerequisite tasks). Note that tasks | 235 | * priorities and prerequisite tasks). Note that tasks |
235 | * scheduled AFTER this call may still be delayed arbitrarily. | 236 | * scheduled AFTER this call may still be delayed arbitrarily. |
236 | */ | 237 | */ |
237 | void GNUNET_SCHEDULER_shutdown (); | 238 | void |
239 | GNUNET_SCHEDULER_shutdown (); | ||
238 | 240 | ||
239 | 241 | ||
240 | /** | 242 | /** |
@@ -248,7 +250,8 @@ void GNUNET_SCHEDULER_shutdown (); | |||
248 | * all priority levels | 250 | * all priority levels |
249 | * @return number of tasks pending right now | 251 | * @return number of tasks pending right now |
250 | */ | 252 | */ |
251 | unsigned int GNUNET_SCHEDULER_get_load (enum GNUNET_SCHEDULER_Priority p); | 253 | unsigned int |
254 | GNUNET_SCHEDULER_get_load (enum GNUNET_SCHEDULER_Priority p); | ||
252 | 255 | ||
253 | 256 | ||
254 | /** | 257 | /** |
@@ -258,7 +261,8 @@ unsigned int GNUNET_SCHEDULER_get_load (enum GNUNET_SCHEDULER_Priority p); | |||
258 | * | 261 | * |
259 | * * @return reason(s) why the current task is run | 262 | * * @return reason(s) why the current task is run |
260 | */ | 263 | */ |
261 | enum GNUNET_SCHEDULER_Reason GNUNET_SCHEDULER_get_reason (); | 264 | enum GNUNET_SCHEDULER_Reason |
265 | GNUNET_SCHEDULER_get_reason (); | ||
262 | 266 | ||
263 | 267 | ||
264 | /** | 268 | /** |
@@ -268,7 +272,8 @@ enum GNUNET_SCHEDULER_Reason GNUNET_SCHEDULER_get_reason (); | |||
268 | * * @param task id of the task to cancel | 272 | * * @param task id of the task to cancel |
269 | * @return the closure of the callback of the cancelled task | 273 | * @return the closure of the callback of the cancelled task |
270 | */ | 274 | */ |
271 | void *GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_TaskIdentifier task); | 275 | void * |
276 | GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_TaskIdentifier task); | ||
272 | 277 | ||
273 | 278 | ||
274 | /** | 279 | /** |
@@ -280,9 +285,9 @@ void *GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_TaskIdentifier task); | |||
280 | * @param task_cls closure of task | 285 | * @param task_cls closure of task |
281 | * @param reason reason for task invocation | 286 | * @param reason reason for task invocation |
282 | */ | 287 | */ |
283 | void GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_Task task, | 288 | void |
284 | void *task_cls, | 289 | GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_Task task, void *task_cls, |
285 | enum GNUNET_SCHEDULER_Reason reason); | 290 | enum GNUNET_SCHEDULER_Reason reason); |
286 | 291 | ||
287 | 292 | ||
288 | /** | 293 | /** |
@@ -315,13 +320,9 @@ GNUNET_SCHEDULER_add_after (GNUNET_SCHEDULER_TaskIdentifier prerequisite_task, | |||
315 | * @return unique task identifier for the job | 320 | * @return unique task identifier for the job |
316 | * only valid until "task" is started! | 321 | * only valid until "task" is started! |
317 | */ | 322 | */ |
318 | GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_with_priority (enum | 323 | GNUNET_SCHEDULER_TaskIdentifier |
319 | GNUNET_SCHEDULER_Priority | 324 | GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, |
320 | prio, | 325 | GNUNET_SCHEDULER_Task task, void *task_cls); |
321 | GNUNET_SCHEDULER_Task | ||
322 | task, | ||
323 | void | ||
324 | *task_cls); | ||
325 | 326 | ||
326 | 327 | ||
327 | /** | 328 | /** |
@@ -333,8 +334,8 @@ GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_with_priority (enum | |||
333 | * @return unique task identifier for the job | 334 | * @return unique task identifier for the job |
334 | * only valid until "task" is started! | 335 | * only valid until "task" is started! |
335 | */ | 336 | */ |
336 | GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_Task | 337 | GNUNET_SCHEDULER_TaskIdentifier |
337 | task, void *task_cls); | 338 | GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_Task task, void *task_cls); |
338 | 339 | ||
339 | 340 | ||
340 | /** | 341 | /** |
@@ -351,12 +352,10 @@ GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_Task | |||
351 | * @return unique task identifier for the job | 352 | * @return unique task identifier for the job |
352 | * only valid until "task" is started! | 353 | * only valid until "task" is started! |
353 | */ | 354 | */ |
354 | GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_now_with_lifeness (int | 355 | GNUNET_SCHEDULER_TaskIdentifier |
355 | lifeness, | 356 | GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, |
356 | GNUNET_SCHEDULER_Task | 357 | GNUNET_SCHEDULER_Task task, |
357 | task, | 358 | void *task_cls); |
358 | void | ||
359 | *task_cls); | ||
360 | 359 | ||
361 | 360 | ||
362 | /** | 361 | /** |
@@ -371,12 +370,9 @@ GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_now_with_lifeness (int | |||
371 | * @return unique task identifier for the job | 370 | * @return unique task identifier for the job |
372 | * only valid until "task" is started! | 371 | * only valid until "task" is started! |
373 | */ | 372 | */ |
374 | GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_delayed (struct | 373 | GNUNET_SCHEDULER_TaskIdentifier |
375 | GNUNET_TIME_Relative | 374 | GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, |
376 | delay, | 375 | GNUNET_SCHEDULER_Task task, void *task_cls); |
377 | GNUNET_SCHEDULER_Task | ||
378 | task, | ||
379 | void *task_cls); | ||
380 | 376 | ||
381 | 377 | ||
382 | /** | 378 | /** |
@@ -395,15 +391,10 @@ GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_delayed (struct | |||
395 | * @return unique task identifier for the job | 391 | * @return unique task identifier for the job |
396 | * only valid until "task" is started! | 392 | * only valid until "task" is started! |
397 | */ | 393 | */ |
398 | GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_read_net (struct | 394 | GNUNET_SCHEDULER_TaskIdentifier |
399 | GNUNET_TIME_Relative | 395 | GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, |
400 | delay, | 396 | struct GNUNET_NETWORK_Handle *rfd, |
401 | struct | 397 | GNUNET_SCHEDULER_Task task, void *task_cls); |
402 | GNUNET_NETWORK_Handle | ||
403 | *rfd, | ||
404 | GNUNET_SCHEDULER_Task | ||
405 | task, | ||
406 | void *task_cls); | ||
407 | 398 | ||
408 | 399 | ||
409 | /** | 400 | /** |
@@ -422,15 +413,10 @@ GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_read_net (struct | |||
422 | * @return unique task identifier for the job | 413 | * @return unique task identifier for the job |
423 | * only valid until "task" is started! | 414 | * only valid until "task" is started! |
424 | */ | 415 | */ |
425 | GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_write_net (struct | 416 | GNUNET_SCHEDULER_TaskIdentifier |
426 | GNUNET_TIME_Relative | 417 | GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, |
427 | delay, | 418 | struct GNUNET_NETWORK_Handle *wfd, |
428 | struct | 419 | GNUNET_SCHEDULER_Task task, void *task_cls); |
429 | GNUNET_NETWORK_Handle | ||
430 | *wfd, | ||
431 | GNUNET_SCHEDULER_Task | ||
432 | task, | ||
433 | void *task_cls); | ||
434 | 420 | ||
435 | 421 | ||
436 | /** | 422 | /** |
@@ -449,15 +435,10 @@ GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_write_net (struct | |||
449 | * @return unique task identifier for the job | 435 | * @return unique task identifier for the job |
450 | * only valid until "task" is started! | 436 | * only valid until "task" is started! |
451 | */ | 437 | */ |
452 | GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_read_file (struct | 438 | GNUNET_SCHEDULER_TaskIdentifier |
453 | GNUNET_TIME_Relative | 439 | GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay, |
454 | delay, | 440 | const struct GNUNET_DISK_FileHandle *rfd, |
455 | const struct | 441 | GNUNET_SCHEDULER_Task task, void *task_cls); |
456 | GNUNET_DISK_FileHandle | ||
457 | *rfd, | ||
458 | GNUNET_SCHEDULER_Task | ||
459 | task, | ||
460 | void *task_cls); | ||
461 | 442 | ||
462 | 443 | ||
463 | /** | 444 | /** |
@@ -476,16 +457,10 @@ GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_read_file (struct | |||
476 | * @return unique task identifier for the job | 457 | * @return unique task identifier for the job |
477 | * only valid until "task" is started! | 458 | * only valid until "task" is started! |
478 | */ | 459 | */ |
479 | GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_write_file (struct | 460 | GNUNET_SCHEDULER_TaskIdentifier |
480 | GNUNET_TIME_Relative | 461 | GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay, |
481 | delay, | 462 | const struct GNUNET_DISK_FileHandle *wfd, |
482 | const struct | 463 | GNUNET_SCHEDULER_Task task, void *task_cls); |
483 | GNUNET_DISK_FileHandle | ||
484 | *wfd, | ||
485 | GNUNET_SCHEDULER_Task | ||
486 | task, | ||
487 | void | ||
488 | *task_cls); | ||
489 | 464 | ||
490 | 465 | ||
491 | /** | 466 | /** |
@@ -520,23 +495,13 @@ GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_write_file (struct | |||
520 | * @return unique task identifier for the job | 495 | * @return unique task identifier for the job |
521 | * only valid until "task" is started! | 496 | * only valid until "task" is started! |
522 | */ | 497 | */ |
523 | GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_select (enum | 498 | GNUNET_SCHEDULER_TaskIdentifier |
524 | GNUNET_SCHEDULER_Priority | 499 | GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, |
525 | prio, | 500 | GNUNET_SCHEDULER_TaskIdentifier prerequisite_task, |
526 | GNUNET_SCHEDULER_TaskIdentifier | 501 | struct GNUNET_TIME_Relative delay, |
527 | prerequisite_task, | 502 | const struct GNUNET_NETWORK_FDSet *rs, |
528 | struct | 503 | const struct GNUNET_NETWORK_FDSet *ws, |
529 | GNUNET_TIME_Relative | 504 | GNUNET_SCHEDULER_Task task, void *task_cls); |
530 | delay, | ||
531 | const struct | ||
532 | GNUNET_NETWORK_FDSet | ||
533 | *rs, | ||
534 | const struct | ||
535 | GNUNET_NETWORK_FDSet | ||
536 | *ws, | ||
537 | GNUNET_SCHEDULER_Task | ||
538 | task, | ||
539 | void *task_cls); | ||
540 | 505 | ||
541 | /** | 506 | /** |
542 | * Sets the select function to use in the scheduler (scheduler_select). | 507 | * Sets the select function to use in the scheduler (scheduler_select). |
@@ -544,8 +509,9 @@ GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_select (enum | |||
544 | * @param new_select new select function to use (NULL to reset to default) | 509 | * @param new_select new select function to use (NULL to reset to default) |
545 | * @param new_select_cls closure for 'new_select' | 510 | * @param new_select_cls closure for 'new_select' |
546 | */ | 511 | */ |
547 | void GNUNET_SCHEDULER_set_select (GNUNET_SCHEDULER_select new_select, | 512 | void |
548 | void *new_select_cls); | 513 | GNUNET_SCHEDULER_set_select (GNUNET_SCHEDULER_select new_select, |
514 | void *new_select_cls); | ||
549 | 515 | ||
550 | 516 | ||
551 | #if 0 /* keep Emacsens' auto-indent happy */ | 517 | #if 0 /* keep Emacsens' auto-indent happy */ |