/* 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;
};
*
* \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.
};
/**
- * 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)
{
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.
* 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.
};
/**
- * 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)
{
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
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,