diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-11-13 11:38:19 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-11-13 11:38:19 +0000 |
commit | 70de2534e40ac0768f0f0d62a2b9d7bc593fba82 (patch) | |
tree | f3aed7740cc203b430999f2c9355a217c7aeb24b | |
parent | 9cd258d4831daf2cf68db9a9d22717287bdfa70b (diff) | |
download | gnunet-70de2534e40ac0768f0f0d62a2b9d7bc593fba82.tar.gz gnunet-70de2534e40ac0768f0f0d62a2b9d7bc593fba82.zip |
add now
-rw-r--r-- | src/include/gnunet_scheduler_lib.h | 16 | ||||
-rw-r--r-- | src/util/scheduler.c | 25 |
2 files changed, 41 insertions, 0 deletions
diff --git a/src/include/gnunet_scheduler_lib.h b/src/include/gnunet_scheduler_lib.h index 16fd2e807..283d46dab 100644 --- a/src/include/gnunet_scheduler_lib.h +++ b/src/include/gnunet_scheduler_lib.h | |||
@@ -324,6 +324,22 @@ GNUNET_SCHEDULER_add_with_priority (struct GNUNET_SCHEDULER_Handle *sched, | |||
324 | 324 | ||
325 | 325 | ||
326 | /** | 326 | /** |
327 | * Schedule a new task to be run as soon as possible. The task | ||
328 | * will be run with the priority of the calling task. | ||
329 | * | ||
330 | * @param sched scheduler to use | ||
331 | * @param task main function of the task | ||
332 | * @param task_cls closure of task | ||
333 | * @return unique task identifier for the job | ||
334 | * only valid until "task" is started! | ||
335 | */ | ||
336 | GNUNET_SCHEDULER_TaskIdentifier | ||
337 | GNUNET_SCHEDULER_add_now (struct GNUNET_SCHEDULER_Handle *sched, | ||
338 | GNUNET_SCHEDULER_Task task, | ||
339 | void *task_cls); | ||
340 | |||
341 | |||
342 | /** | ||
327 | * Schedule a new task to be run with a specified delay. The task | 343 | * Schedule a new task to be run with a specified delay. The task |
328 | * will be scheduled for execution once the delay has expired. It | 344 | * will be scheduled for execution once the delay has expired. It |
329 | * will be run with the priority of the calling task. | 345 | * will be run with the priority of the calling task. |
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index ee4a9a4f3..1df907a20 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -832,6 +832,31 @@ GNUNET_SCHEDULER_add_delayed (struct GNUNET_SCHEDULER_Handle * sched, | |||
832 | } | 832 | } |
833 | 833 | ||
834 | 834 | ||
835 | |||
836 | /** | ||
837 | * Schedule a new task to be run as soon as possible. The task | ||
838 | * will be run with the priority of the calling task. | ||
839 | * | ||
840 | * @param sched scheduler to use | ||
841 | * @param task main function of the task | ||
842 | * @param task_cls closure of task | ||
843 | * @return unique task identifier for the job | ||
844 | * only valid until "task" is started! | ||
845 | */ | ||
846 | GNUNET_SCHEDULER_TaskIdentifier | ||
847 | GNUNET_SCHEDULER_add_now (struct GNUNET_SCHEDULER_Handle *sched, | ||
848 | GNUNET_SCHEDULER_Task task, | ||
849 | void *task_cls) | ||
850 | { | ||
851 | return GNUNET_SCHEDULER_add_select (sched, | ||
852 | GNUNET_SCHEDULER_PRIORITY_KEEP, | ||
853 | GNUNET_SCHEDULER_NO_TASK, | ||
854 | GNUNET_TIME_UNIT_ZERO, | ||
855 | NULL, NULL, task, task_cls); | ||
856 | } | ||
857 | |||
858 | |||
859 | |||
835 | /** | 860 | /** |
836 | * Schedule a new task to be run with a specified delay or when the | 861 | * Schedule a new task to be run with a specified delay or when the |
837 | * specified file descriptor is ready for reading. The delay can be | 862 | * specified file descriptor is ready for reading. The delay can be |