]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Misc documentation cleanups related to select().
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 7 Oct 2021 20:16:09 +0000 (22:16 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 25 Aug 2022 13:37:26 +0000 (15:37 +0200)
Assorted comment cleanups which avoid to talk about select(2) and
fd sets. No code changes.

alsa_write.c
audiod_command.c
check_wav.c
send.h
signal.c
signal.h
vss.c

index 192233442b7346278634e749567d898dda5d05a8..b13697ab612d9bbed78f39ab85e501c56ca97319 100644 (file)
@@ -48,7 +48,7 @@ struct private_alsa_write_data {
        /* time until buffer underrun occurs, in milliseconds */
        unsigned buffer_time;
        struct timeval drain_barrier;
-       /* File descriptor for select(). */
+       /* File descriptor to monitor for reading. */
        int poll_fd;
 };
 
index 677abe340bfdc801422caee920c611ff6a70d33a..795e2ac84657150a1a8d64947e30a7ba4a217796 100644 (file)
@@ -361,8 +361,8 @@ EXPORT_AUDIOD_CMD_HANDLER(version)
  *
  * \param accept_fd The fd to accept connections on.
  *
- * This is called in each iteration of the select loop. If there is an incoming
- * connection on \a accept_fd, this function reads the command sent by the peer,
+ * This is called in each iteration of the main loop of the scheduler. If there
+ * is an incoming connection, the function reads the command sent by the peer,
  * checks the connecting user's permissions by using unix socket credentials
  * (if supported by the OS) and calls the corresponding command handler if
  * permissions are OK.
index 89ebdacc0805e9575acea92d09ed3b2dd81ebac3..074ad8fe74fbfe4b383a98d2d69ecf48c175f443 100644 (file)
@@ -39,13 +39,13 @@ struct check_wav_context {
 };
 
 /**
- * Set select timeout according to the given context.
+ * Request a minimal timeout if not idle.
  *
- * \param s Contains the timeval that should be set.
- * \param cwc Contains a pointer to the buffer tree node.
+ * \param s The scheduler instance.
+ * \param cwc The buffer tree node is derived from this.
  *
- * This requests a minimal timeout from the scheduler if btrn of \a cwc is not
- * idle.
+ * If no data is available and the buffer tree node is not in error state, the
+ * function does nothing.
  */
 void check_wav_pre_select(struct sched *s, struct check_wav_context *cwc)
 {
diff --git a/send.h b/send.h
index 1d9db37ec82ab90714a38d96f2ab4e889eb07d9d..25a1103da1ca589de61173e4509cfb026be187c4 100644 (file)
--- a/send.h
+++ b/send.h
@@ -76,23 +76,9 @@ struct sender {
        void (*send)(long unsigned current_chunk, long unsigned chunks_sent,
                const char *buf, size_t len, const char *header_buf,
                size_t header_len);
-       /**
-        * Add file descriptors to fd_sets.
-        *
-        * The pre_select function of each supported sender is called just before
-        * para_server enters its main select loop. Each sender may watch its own
-        * file descriptors for reading or writing.
-        *
-        * \sa select(2).
-        */
+       /** Ask the scheduler to monitor file descriptors. */
        void (*pre_select)(struct sched *s);
-       /**
-        * Handle the file descriptors which are ready for I/O.
-        *
-        * If the pre_select hook asked for one or more file descriptors to be
-        * watched, this is the hook to check the result and perform I/O on the
-        * descriptors which are ready for reading/writing.
-        */
+       /** Perform I/O on the file descriptors which are ready. */
        void (*post_select)(struct sched *s);
        /**
         * Terminate all connected clients.
index 27bda8407faf73a9812246e12bb3b98645a62fae..e5ef7a4119dc271320079d778313c5abf1d259d2 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -27,7 +27,7 @@ static int signal_pipe[2];
  * signal arrives, the signal handler writes the number of the signal received
  * to one end of the signal pipe. The application can test for pending signals
  * by checking if the file descriptor of the other end of the signal pipe is
- * ready for reading, see select(2).
+ * ready for reading.
  *
  * \return This function either succeeds or calls exit(3) to terminate the
  * current process. On success, a signal task structure is returned.
index 3522102421cd5fdcd9a2f5ca0b5fef4f63330859..d65d18e35e87a8c957f4bfb0bdb520cb9ae44c33 100644 (file)
--- a/signal.h
+++ b/signal.h
@@ -13,20 +13,19 @@ struct signal_task {
 };
 
 /**
- * A generic pre-select method for signal tasks.
+ * Monitor the signal fd for reading.
  *
- * \param s Used to watch the signal fd for reading.
+ * \param s The scheduler instance.
  * \param context Signal task pointer.
  *
  * This convenience helper is called from several programs which need to handle
- * signals, including para_server and para_audiod. These programs define a
- * signal task structure and set its ->pre_select method to this function which
- * adds the file descriptor of the signal task to the set of descriptors to be
- * watched in the next select() call.
+ * signals, including para_server and para_audiod. These programs set up a
+ * signal pipe and a signal task structure, and use this function to tell the
+ * scheduler to monitor the read end of the pipe.
  *
  * Although the second parameter must be in fact a pointer to a signal_task
- * structure, the parameter is specified as void * here to match the
- * ->pre_select method of struct task.
+ * structure, the parameter is specified as void * here to match the signature
+ * declared in struct \ref task_info.
  */
 _static_inline_ void signal_pre_select(struct sched *s, void *context)
 {
diff --git a/vss.c b/vss.c
index fce5281b5d3f750592016839bd14649452a93011..49fd7ae2a38b21339d424e52623cd5e425132681 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -43,7 +43,7 @@ const struct sender * const senders[] = {
 enum afs_socket_status {
        /** Socket is inactive. */
        AFS_SOCKET_READY,
-       /** Socket fd was included in the write fd set for select(). */
+       /** Socket fd was monitored for writing. */
        AFS_SOCKET_CHECK_FOR_WRITE,
        /** vss wrote a request to the socket and waits for reply from afs. */
        AFS_SOCKET_AFD_PENDING
@@ -827,7 +827,7 @@ static void vss_compute_timeout(struct sched *s, struct vss_task *vsst)
        if (sched_request_barrier(&vsst->data_send_barrier, s) == 1)
                return;
        /*
-        * Compute the select timeout as the minimal time until the next
+        * Compute the I/O timeout as the minimal time until the next
         * chunk/slice is due for any client.
         */
        compute_chunk_time(mmd->chunks_sent, &mmd->afd.afhi.chunk_tv,