add now
authorChristian Grothoff <christian@grothoff.org>
Fri, 13 Nov 2009 11:38:19 +0000 (11:38 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 13 Nov 2009 11:38:19 +0000 (11:38 +0000)
src/include/gnunet_scheduler_lib.h
src/util/scheduler.c

index 16fd2e807db78ff0ef162f75165918f77fa9baaf..283d46dabfb20ab85a8f28eabd8cf9ab05ce6425 100644 (file)
@@ -323,6 +323,22 @@ GNUNET_SCHEDULER_add_with_priority (struct GNUNET_SCHEDULER_Handle *sched,
                                    void *task_cls);
 
 
+/**
+ * Schedule a new task to be run as soon as possible. The task
+ * will be run with the priority of the calling task.
+ *
+ * @param sched scheduler to use
+ * @param task main function of the task
+ * @param task_cls closure of task
+ * @return unique task identifier for the job
+ *         only valid until "task" is started!
+ */
+GNUNET_SCHEDULER_TaskIdentifier
+GNUNET_SCHEDULER_add_now (struct GNUNET_SCHEDULER_Handle *sched,
+                         GNUNET_SCHEDULER_Task task,
+                         void *task_cls);
+
+
 /**
  * Schedule a new task to be run with a specified delay.  The task
  * will be scheduled for execution once the delay has expired. It
index ee4a9a4f3b761875a63b2f2ba90992e04650d28f..1df907a203b8920770bdbe01017ebf1a28f1b26d 100644 (file)
@@ -832,6 +832,31 @@ GNUNET_SCHEDULER_add_delayed (struct GNUNET_SCHEDULER_Handle * sched,
 }
 
 
+
+/**
+ * Schedule a new task to be run as soon as possible. The task
+ * will be run with the priority of the calling task.
+ *
+ * @param sched scheduler to use
+ * @param task main function of the task
+ * @param task_cls closure of task
+ * @return unique task identifier for the job
+ *         only valid until "task" is started!
+ */
+GNUNET_SCHEDULER_TaskIdentifier
+GNUNET_SCHEDULER_add_now (struct GNUNET_SCHEDULER_Handle *sched,
+                         GNUNET_SCHEDULER_Task task,
+                         void *task_cls)
+{
+  return GNUNET_SCHEDULER_add_select (sched,
+                                      GNUNET_SCHEDULER_PRIORITY_KEEP,
+                                      GNUNET_SCHEDULER_NO_TASK,
+                                     GNUNET_TIME_UNIT_ZERO,
+                                      NULL, NULL, task, task_cls);
+}
+
+
+
 /**
  * Schedule a new task to be run with a specified delay or when the
  * specified file descriptor is ready for reading.  The delay can be