]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 1 Jun 2025 01:36:59 +0000 (03:36 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Tue, 10 Jun 2025 14:04:43 +0000 (16:04 +0200)
sched.c
sched.h

diff --git a/sched.c b/sched.c
index 475dead54d1a8db988fbbf159179aca2e0f6ec3e..3eea90effdd1474a0a07608572be029a7835c182 100644 (file)
--- a/sched.c
+++ b/sched.c
@@ -2,7 +2,6 @@
 
 /** \file sched.c Paraslash's scheduling functions. */
 
-
 #include "para.h"
 #include "ipc.h"
 #include "fd.h"
diff --git a/sched.h b/sched.h
index ede5e67ea2ac042c5765a92e6100bc00ab47e103..8819232d9b51c866d5f4f052eeeeb9ac9587f834 100644 (file)
--- a/sched.h
+++ b/sched.h
@@ -1,19 +1,24 @@
 /* Copyright (C) 2006 Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */
 
-/** \file sched.h Sched and task structures and exported symbols from sched.c. */
-
-
-/**
- * Paraslash's scheduler.
+/** \file sched.h The paraslash scheduler
  *
- * Designed with KISS in mind. It maintains a list of task structures which is
- * extended when a new task is registered. Each task may define a pre_monitor
- * function which is called from the scheduler main loop before it calls
- * poll(2). Similarly, each task must define a post_monitor function which is
- * called after poll(2) returns.
+ * The scheduler maintains a list of task structures where each list element
+ * represents a task that has been registered to the scheduler by calling
+ * \ref task_register(). At each iteration of main loop, the scheduler
+ * calls the pre-monitor functions to set up two file descriptor sets and to
+ * compute the timeout for the subsequent call to poll(2). The post-monitor
+ * functions are called after poll(2) returns. They are supposed to perform
+ * read/write operations if the poll(2) call indicated that the file descriptor
+ * is ready for I/O.
  *
- * \sa select(2), poll(2).
+ * Inter-task communication is possible through a notification API also
+ * described here.
+ *
+ * The functions declared here are implemented in \ref sched.c. All paraslash
+ * executables employ the scheduler.
  */
+
+/** \par Describes a scheduler instance. */
 struct sched {
        /** Initial value (in milliseconds) before any pre_monitor call. */
        int default_timeout;
@@ -23,11 +28,11 @@ struct sched {
        struct pollfd *pfd;
        /** Number of elements in the above array, passed to poll(2). */
        unsigned pfd_array_len;
-       /** Number of fds registered for montitoring so far. */
+       /** Number of fds registered for monitoring so far. */
        unsigned num_pfds;
        /** Maps fds to indices of the pfd array. */
        unsigned *pidx;
-       /** Mumber of elements in the above pidx array. */
+       /** Number of elements in the above pidx array. */
        unsigned pidx_array_len;
        /** If non-NULL, use this function instead of \ref xpoll(). */
        int (*poll_function)(struct pollfd *fds, nfds_t nfds, int timeout);