- if (!initialized)
- return -E_NOT_INITIALIZED;
- list_for_each_entry_safe(t, tmp, &pre_select_list, pre_select_node) {
- sprintf(buf, "%p", t);
- if (strcmp(id, buf))
- continue;
- t->error = -E_TASK_KILLED;
- return 1;
- }
- list_for_each_entry_safe(t, tmp, &post_select_list, post_select_node) {
- sprintf(buf, "%p", t);
- if (strcmp(id, buf))
- continue;
- t->error = -E_TASK_KILLED;
- return 1;
+/**
+ * Force the next select() call to return before the given amount of milliseconds.
+ *
+ * \param ms The maximal allowed timeout in milliseconds.
+ * \param s Pointer to the scheduler struct.
+ *
+ * Like sched_request_timeout() this imposes an upper bound on the timeout
+ * value for the next select() call.
+ */
+void sched_request_timeout_ms(long unsigned ms, struct sched *s)
+{
+ struct timeval tv;
+ ms2tv(ms, &tv);
+ sched_request_timeout(&tv, s);
+}
+
+/**
+ * Force the next select() call to return before the given future time.
+ *
+ * \param barrier Absolute time before select() should return.
+ * \param s Pointer to the scheduler struct.
+ *
+ * \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().
+ */
+int sched_request_barrier(struct timeval *barrier, struct sched *s)
+{
+ struct timeval diff;
+
+ if (tv_diff(now, barrier, &diff) > 0)
+ return 0;
+ sched_request_timeout(&diff, s);
+ return 1;
+}
+
+/**
+ * Force the next select() call to return before the given time.
+ *
+ * \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 and
+ * returns zero. Otherwise it returns one.
+ *
+ * \sa sched_min_delay(), sched_request_barrier().
+ */
+int sched_request_barrier_or_min_delay(struct timeval *barrier, struct sched *s)
+{
+ struct timeval diff;
+
+ if (tv_diff(now, barrier, &diff) > 0) {
+ sched_min_delay(s);
+ return 0;