* future), but only if the return value is "GNUNET_NO" (and
* the "lowest_pending_id" check failed).
*
- * @param sched the scheduler
* @param id which task are we checking for
* @return GNUNET_YES if so, GNUNET_NO if not
*/
/**
* Update all sets and timeout for select.
*
- * @param sched the scheduler
* @param rs read-set, set to all FDs we would like to read (updated)
* @param ws write-set, set to all FDs we would like to write (updated)
* @param timeout next timeout (updated)
* Check if the given task is eligible to run now.
* Also set the reason why it is eligible.
*
- * @param sched the scheduler
* @param task task to check if it is ready
* @param now the current time
* @param rs set of FDs ready for reading
* cause all tasks to run (as soon as possible, respecting
* priorities and prerequisite tasks). Note that tasks
* scheduled AFTER this call may still be delayed arbitrarily.
- *
- * @param sched the scheduler
*/
void
GNUNET_SCHEDULER_shutdown ()
* may become ready, hence we should select on it). Naturally, if
* there are no more ready tasks, we also return.
*
- * @param sched the scheduler
* @param rs FDs ready for reading
* @param ws FDs ready for writing
*/
snprintf (lsof, sizeof (lsof), "lsof -p %d", getpid());
close (1);
dup2 (2, 1);
- system (lsof);
+ ret = system (lsof);
#endif
#endif
abort ();
* started. Will return the same value as
* the GNUNET_SCHEDULER_TaskContext's reason field.
*
- * @param sched scheduler to query
* @return reason(s) why the current task is run
*/
enum GNUNET_SCHEDULER_Reason
* dropped (if the decision should be made based on the number of
* tasks ready to run).
*
- * @param sched scheduler to query
* @param p priority level to look at
* @return number of tasks pending right now
*/
* Cancel the task with the specified identifier.
* The task must not yet have run.
*
- * @param sched scheduler to use
* @param task id of the task to cancel
* @return original closure of the task
*/
* similar to the other "add" functions except that there is no delay
* and the reason code can be specified.
*
- * @param sched scheduler to use
* @param task main function of the task
* @param task_cls closure for 'main'
* @param reason reason for task invocation
* has completed. It will be run with the priority of the calling
* task.
*
- * @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-readiness
/**
* Schedule a new task to be run with a specified priority.
*
- * @param sched scheduler to use
* @param prio how important is the new task?
* @param task main function of the task
* @param task_cls closure of task
* will be scheduled for execution once the delay has expired. It
* will be run with the priority of the calling task.
*
- * @param sched scheduler to use
* @param delay when should this operation time out? Use
* GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown"
* @param task main function of the task
#else
/* unoptimized version */
- return GNUNET_SCHEDULER_add_select (sched,
- GNUNET_SCHEDULER_PRIORITY_KEEP,
+ return GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_KEEP,
GNUNET_SCHEDULER_NO_TASK, delay,
NULL, NULL, task, task_cls);
#endif
* 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
* || shutdown-active )
* </code>
*
- * @param sched scheduler to use
* @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL for "forever",
* which means that the task will only be run after we receive SIGTERM
* @param rfd file descriptor we want to read (can be -1)
* @return unique task identifier for the job
* only valid until "task" is started!
*/
+#ifndef MINGW
GNUNET_SCHEDULER_TaskIdentifier
add_without_sets (struct GNUNET_TIME_Relative delay,
int rfd,
#endif
return t->id;
}
+#endif
* socket operation is ready. It will be run with the priority of
* the calling task.
*
- * @param sched scheduler to use
* @param delay when should this operation time out? Use
* GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown"
* @param rfd read file-descriptor
struct GNUNET_NETWORK_Handle * rfd,
GNUNET_SCHEDULER_Task task, void *task_cls)
{
+#if MINGW
+ struct GNUNET_NETWORK_FDSet *rs;
+ GNUNET_SCHEDULER_TaskIdentifier ret;
+
+ GNUNET_assert (rfd != NULL);
+ rs = GNUNET_NETWORK_fdset_create ();
+ GNUNET_NETWORK_fdset_set (rs, rfd);
+ ret = GNUNET_SCHEDULER_add_select (check_priority (current_priority),
+ GNUNET_SCHEDULER_NO_TASK, delay,
+ rs, NULL, task, task_cls);
+ GNUNET_NETWORK_fdset_destroy (rs);
+ return ret;
+#else
return add_without_sets (delay,
GNUNET_NETWORK_get_fd (rfd),
-1,
task,
task_cls);
+#endif
}
* socket operation is ready. It will be run with the priority of
* the calling task.
*
- * @param sched scheduler to use
* @param delay when should this operation time out? Use
* GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown"
* @param wfd write file-descriptor
struct GNUNET_NETWORK_Handle * wfd,
GNUNET_SCHEDULER_Task task, void *task_cls)
{
+#if MINGW
+ struct GNUNET_NETWORK_FDSet *ws;
+ GNUNET_SCHEDULER_TaskIdentifier ret;
+
+ GNUNET_assert (wfd != NULL);
+ ws = GNUNET_NETWORK_fdset_create ();
+ GNUNET_NETWORK_fdset_set (ws, wfd);
+ ret = GNUNET_SCHEDULER_add_select (check_priority (current_priority),
+ GNUNET_SCHEDULER_NO_TASK, delay,
+ NULL, ws, task, task_cls);
+ GNUNET_NETWORK_fdset_destroy (ws);
+ return ret;
+#else
return add_without_sets (delay,
-1,
GNUNET_NETWORK_get_fd (wfd),
task,
task_cls);
+#endif
}
* socket operation is ready. It will be run with the priority of
* the calling task.
*
- * @param sched scheduler to use
* @param delay when should this operation time out? Use
* GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown"
* @param rfd read file-descriptor
GNUNET_assert (rfd != NULL);
rs = GNUNET_NETWORK_fdset_create ();
GNUNET_NETWORK_fdset_handle_set (rs, rfd);
- ret = GNUNET_SCHEDULER_add_select (sched,
- GNUNET_SCHEDULER_PRIORITY_KEEP,
+ ret = GNUNET_SCHEDULER_add_select (check_priority (current_priority),
GNUNET_SCHEDULER_NO_TASK, delay,
rs, NULL, task, task_cls);
GNUNET_NETWORK_fdset_destroy (rs);
* socket operation is ready. It will be run with the priority of
* the calling task.
*
- * @param sched scheduler to use
* @param delay when should this operation time out? Use
* GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown"
* @param wfd write file-descriptor
GNUNET_assert (wfd != NULL);
ws = GNUNET_NETWORK_fdset_create ();
GNUNET_NETWORK_fdset_handle_set (ws, wfd);
- ret = GNUNET_SCHEDULER_add_select (sched,
- GNUNET_SCHEDULER_PRIORITY_KEEP,
+ ret = GNUNET_SCHEDULER_add_select (check_priority (current_priority),
GNUNET_SCHEDULER_NO_TASK,
delay, NULL, ws, task, task_cls);
GNUNET_NETWORK_fdset_destroy (ws);
* || (shutdown-active && run-on-shutdown) )
* </code>
*
- * @param sched scheduler to use
* @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