]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge topic branch t/sched into pu pu
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 12 Jun 2025 23:17:36 +0000 (01:17 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 12 Jun 2025 23:17:36 +0000 (01:17 +0200)
Started on 2025-06-01

* refs/heads/t/sched:
  server: Kill global variable sched.
  Make struct sched private.

# Conflicts:
# sched.h

12 files changed:
1  2 
afs.c
audioc.c
audiod.c
client.c
filter.c
gui.c
play.c
recv.c
sched.c
sched.h
server.c
write.c

diff --cc afs.c
Simple merge
diff --cc audioc.c
Simple merge
diff --cc audiod.c
Simple merge
diff --cc client.c
index b984909effc5cff53ecbd3ae4750ebfb7a4838a6,1061b09cf2236c17d30a9e6bf92f1e48499d86fc..22ec2e15c9bf73f1539bffb0350d66f21974e4d7
+++ b/client.c
  #include "buffer_tree.h"
  #include "error.h"
  
 -/** Array of error strings. */
  DEFINE_PARA_ERRLIST;
  
- static struct sched sched;
+ static struct sched *sched;
  static struct client_task *ct;
  static struct stdin_task sit;
  static struct stdout_task sot;
diff --cc filter.c
Simple merge
diff --cc gui.c
Simple merge
diff --cc play.c
Simple merge
diff --cc recv.c
Simple merge
diff --cc sched.c
Simple merge
diff --cc sched.h
index 2180941e9a792289bfc90248e3bb07d61a5a9614,c5ce994efde1ad44ef4de7af9dfe493cba6b7675..dd41b42a8a5861a50274e92c8b673a43e2d3e400
+++ b/sched.h
@@@ -1,50 -1,10 +1,30 @@@
  /* 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. */
 +/** \file sched.h The paraslash scheduler
 + *
 + * 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.
 + *
 + * 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.
 + */
  
- /** Describes a scheduler instance. */
- struct sched {
-       /** Initial value (in milliseconds) before any pre_monitor call. */
-       int default_timeout;
-       /** The timeout (also in milliseconds) for the next iteration. */
-       int timeout;
-       /** Passed to poll(2). */
-       struct pollfd *pfd;
-       /** Number of elements in the above array, passed to poll(2). */
-       unsigned pfd_array_len;
-       /** Number of fds registered for monitoring so far. */
-       unsigned num_pfds;
-       /** Maps fds to indices of the pfd array. */
-       unsigned *pidx;
-       /** 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);
-       /** Tasks which have been registered to the scheduler. */
-       struct list_head task_list;
- };
+ struct sched;
  
 -/** Information that must be supplied by callers of \ref task_register(). */
 +/**
 + * Information that must be supplied by callers of \ref task_register().
 + *
 + * The structure may be safely discarded after the task has been registered.
 + */
  struct task_info {
        /** Used for log messages and by \ref get_task_list(). */
        const char *name;
diff --cc server.c
Simple merge
diff --cc write.c
Simple merge