aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_scheduler_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-22 00:35:37 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-22 00:35:37 +0100
commit542bf871c6eebdc645884960559e15ce400939e6 (patch)
tree0ce113fefdf83c653c715edb49fd217bad8dcccf /src/include/gnunet_scheduler_lib.h
parent9855137d1312c0a3b3d0836b6c0ab2eb199d70ca (diff)
downloadgnunet-542bf871c6eebdc645884960559e15ce400939e6.tar.gz
gnunet-542bf871c6eebdc645884960559e15ce400939e6.zip
extending scheduler API with 'add_at' functionality to avoid unnecessary time conversions
Diffstat (limited to 'src/include/gnunet_scheduler_lib.h')
-rw-r--r--src/include/gnunet_scheduler_lib.h45
1 files changed, 40 insertions, 5 deletions
diff --git a/src/include/gnunet_scheduler_lib.h b/src/include/gnunet_scheduler_lib.h
index 1a0438bed..2be1858ce 100644
--- a/src/include/gnunet_scheduler_lib.h
+++ b/src/include/gnunet_scheduler_lib.h
@@ -172,7 +172,7 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task,
172 172
173 173
174/** 174/**
175 * Request the shutdown of a scheduler. Marks all tasks 175 * Request the shutdown of a scheduler. Marks all tasks
176 * awaiting shutdown as ready. Note that tasks 176 * awaiting shutdown as ready. Note that tasks
177 * scheduled with #GNUNET_SCHEDULER_add_shutdown() AFTER this call 177 * scheduled with #GNUNET_SCHEDULER_add_shutdown() AFTER this call
178 * will be delayed until the next shutdown signal. 178 * will be delayed until the next shutdown signal.
@@ -309,7 +309,7 @@ GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness,
309 * will be scheduled for execution once the delay has expired. It 309 * will be scheduled for execution once the delay has expired. It
310 * will be run with the DEFAULT priority. 310 * will be run with the DEFAULT priority.
311 * 311 *
312 * @param delay when should this operation time out? 312 * @param delay with which the operation should be run
313 * @param task main function of the task 313 * @param task main function of the task
314 * @param task_cls closure of @a task 314 * @param task_cls closure of @a task
315 * @return unique task identifier for the job 315 * @return unique task identifier for the job
@@ -322,10 +322,27 @@ GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay,
322 322
323 323
324/** 324/**
325 * Schedule a new task to be run at the specified time. The task
326 * will be scheduled for execution once specified time has been
327 * reached. It will be run with the DEFAULT priority.
328 *
329 * @param at time at which this operation should run
330 * @param task main function of the task
331 * @param task_cls closure of @a task
332 * @return unique task identifier for the job
333 * only valid until @a task is started!
334 */
335struct GNUNET_SCHEDULER_Task *
336GNUNET_SCHEDULER_add_at (struct GNUNET_TIME_Absolute at,
337 GNUNET_SCHEDULER_TaskCallback task,
338 void *task_cls);
339
340
341/**
325 * Schedule a new task to be run with a specified delay. The task 342 * Schedule a new task to be run with a specified delay. The task
326 * will be scheduled for execution once the delay has expired. 343 * will be scheduled for execution once the delay has expired.
327 * 344 *
328 * @param delay when should this operation time out? 345 * @param delay when should this operation time out?
329 * @param priority priority to use for the task 346 * @param priority priority to use for the task
330 * @param task main function of the task 347 * @param task main function of the task
331 * @param task_cls closure of @a task 348 * @param task_cls closure of @a task
@@ -340,6 +357,24 @@ GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay,
340 357
341 358
342/** 359/**
360 * Schedule a new task to be run at the specified time. The task
361 * will be scheduled for execution at time @a at.
362 *
363 * @param at time when the operation should run
364 * @param priority priority to use for the task
365 * @param task main function of the task
366 * @param task_cls closure of @a task
367 * @return unique task identifier for the job
368 * only valid until @a task is started!
369 */
370struct GNUNET_SCHEDULER_Task *
371GNUNET_SCHEDULER_add_at_with_priority (struct GNUNET_TIME_Absolute at,
372 enum GNUNET_SCHEDULER_Priority priority,
373 GNUNET_SCHEDULER_TaskCallback task,
374 void *task_cls);
375
376
377/**
343 * Schedule a new task to be run with a specified delay or when the 378 * Schedule a new task to be run with a specified delay or when the
344 * specified file descriptor is ready for reading. The delay can be 379 * specified file descriptor is ready for reading. The delay can be
345 * used as a timeout on the socket being ready. The task will be 380 * used as a timeout on the socket being ready. The task will be
@@ -480,7 +515,7 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay,
480 * scheduled for execution once either the delay has expired or the 515 * scheduled for execution once either the delay has expired or the
481 * socket operation is ready. 516 * socket operation is ready.
482 * 517 *
483 * @param delay when should this operation time out? 518 * @param delay when should this operation time out?
484 * @param priority priority of the task 519 * @param priority priority of the task
485 * @param fd file-descriptor 520 * @param fd file-descriptor
486 * @param on_read whether to poll the file-descriptor for readability 521 * @param on_read whether to poll the file-descriptor for readability
@@ -516,7 +551,7 @@ GNUNET_SCHEDULER_add_file_with_priority (struct GNUNET_TIME_Relative delay,
516 * </code> 551 * </code>
517 * 552 *
518 * @param prio how important is this task? 553 * @param prio how important is this task?
519 * @param delay how long should we wait? 554 * @param delay how long should we wait?
520 * @param rs set of file descriptors we want to read (can be NULL) 555 * @param rs set of file descriptors we want to read (can be NULL)
521 * @param ws set of file descriptors we want to write (can be NULL) 556 * @param ws set of file descriptors we want to write (can be NULL)
522 * @param task main function of the task 557 * @param task main function of the task