Make these functions tell its caller whether the given barrier
was in the past. This is useful for vss because for certain
barriers, no other actions should be performed before the barrier
has passed.
- if (!pad)
- return sched_min_delay(s);
- if (ret < 0)
- return sched_request_barrier_or_min_delay(&pad->drain_barrier, s);
+ if (!pad) {
+ sched_min_delay(s);
+ return;
+ }
+ if (ret < 0) {
+ sched_request_barrier_or_min_delay(&pad->drain_barrier, s);
+ return;
+ }
/*
* Data is available to be written to the alsa handle. Compute number
* of milliseconds until next buffer underrun would occur.
/*
* Data is available to be written to the alsa handle. Compute number
* of milliseconds until next buffer underrun would occur.
* \param barrier Absolute time before select() should return.
* \param s Pointer to the scheduler struct.
*
* \param barrier Absolute time before select() should return.
* \param s Pointer to the scheduler struct.
*
- * If \a barrier is in the past, this function does nothing.
+ * \return If \a barrier is in the past, this function does nothing and returns
+ * zero. Otherwise it returns one.
*
* \sa sched_request_barrier_or_min_delay().
*/
*
* \sa sched_request_barrier_or_min_delay().
*/
-void sched_request_barrier(struct timeval *barrier, struct sched *s)
+int sched_request_barrier(struct timeval *barrier, struct sched *s)
{
struct timeval diff;
if (tv_diff(now, barrier, &diff) > 0)
{
struct timeval diff;
if (tv_diff(now, barrier, &diff) > 0)
sched_request_timeout(&diff, s);
sched_request_timeout(&diff, s);
* \param barrier Absolute time before select() should return.
* \param s Pointer to the scheduler struct.
*
* \param barrier Absolute time before select() should return.
* \param s Pointer to the scheduler struct.
*
- * If \a barrier is in the past, this function requests a minimal timeout.
+ * If \a barrier is in the past, this function requests a minimal timeout and
+ * returns zero. Otherwise it returns one.
*
* \sa sched_min_delay(), sched_request_barrier().
*/
*
* \sa sched_min_delay(), sched_request_barrier().
*/
-void sched_request_barrier_or_min_delay(struct timeval *barrier, struct sched *s)
+int sched_request_barrier_or_min_delay(struct timeval *barrier, struct sched *s)
- if (tv_diff(now, barrier, &diff) > 0)
- return sched_min_delay(s);
+ if (tv_diff(now, barrier, &diff) > 0) {
+ sched_min_delay(s);
+ return 0;
+ }
sched_request_timeout(&diff, s);
sched_request_timeout(&diff, s);
void sched_min_delay(struct sched *s);
void sched_request_timeout(struct timeval *to, struct sched *s);
void sched_request_timeout_ms(long unsigned ms, struct sched *s);
void sched_min_delay(struct sched *s);
void sched_request_timeout(struct timeval *to, struct sched *s);
void sched_request_timeout_ms(long unsigned ms, struct sched *s);
-void sched_request_barrier(struct timeval *barrier, struct sched *s);
-void sched_request_barrier_or_min_delay(struct timeval *barrier, struct sched *s);
+int sched_request_barrier(struct timeval *barrier, struct sched *s);
+int sched_request_barrier_or_min_delay(struct timeval *barrier, struct sched *s);