*/
GNUNET_SCHEDULER_PRIORITY_URGENT = 6,
+ /**
+ * This is an internal priority level that is only used for tasks
+ * that are being triggered due to shutdown (they have automatically
+ * highest priority). User code must not use this priority level
+ * directly. Tasks run with this priority level that internally
+ * schedule other tasks will see their original priority level
+ * be inherited (unless otherwise specified).
+ */
+ GNUNET_SCHEDULER_PRIORITY_SHUTDOWN = 7,
+
/**
* Number of priorities (must be the last priority).
* This priority must not be used by clients.
*/
- GNUNET_SCHEDULER_PRIORITY_COUNT = 7
+ GNUNET_SCHEDULER_PRIORITY_COUNT = 8
};
#include "gnunet_time_lib.h"
* and the reason code can be specified.
*
* @param sched scheduler to use
- * @param main main function of the task
- * @param cls closure of task
+ * @param task main function of the task
+ * @param task_cls closure of task
* @param reason reason for task invocation
*/
void
GNUNET_SCHEDULER_add_continuation (struct GNUNET_SCHEDULER_Handle *sched,
- GNUNET_SCHEDULER_Task main,
- void *cls,
+ GNUNET_SCHEDULER_Task task,
+ void *task_cls,
enum GNUNET_SCHEDULER_Reason reason);
* @param sched scheduler to use
* @param prerequisite_task run this task after the task with the given
* task identifier completes (and any of our other
- * conditions, such as delay, read or write-readyness
+ * conditions, such as delay, read or write-readiness
* are satisfied). Use GNUNET_SCHEDULER_NO_TASK to not have any dependency
* on completion of other tasks (this will cause the task to run as
* soon as possible).
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
* @param prio how important is this task?
* @param prerequisite_task run this task after the task with the given
* task identifier completes (and any of our other
- * conditions, such as delay, read or write-readyness
+ * conditions, such as delay, read or write-readiness
* are satisfied). Use GNUNET_SCHEDULER_NO_TASK to not have any dependency
* on completion of other tasks.
* @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL for "forever",