#include <oskit/threads/pthread.h>
#include <oskit/threads/cpuinherit.h>int create_stride_scheduler(pthread_t *tid, const pthread_attr_t *attr, int preemptible);
Create a new Stride scheduler. The pthread_t of the new scheduler is returned in tid. The attributes structure to use when creating the new thread is attr. The preemptible flag indicates whether the new scheduler should use time-based preemption to achieve fairness. Aside from the usual attributes that can be specified, the caller may also specify the new scheduler's scheduler by using pthread_attr_setscheduler. Thus, the caller can set up an arbitrary hierarchy of schedulers and threads.When creating threads that are scheduled by a Stride scheduler, the caller should set the opaque scheduling parameter in the thread creation attributes structure. This opaque value represents a ticket value, and should be an integer (usually a small to moderately sized integer). As with any Stride scheduler, the larger the ticket value, the more CPU a thread is likely to receive.
- tid
- A pointer to the location where the thread id of the new scheduler should be stored.
- attr
- A pointer to the thread creation attributes object.
- preemptible
- A flag indicating whether the new scheduler should use time-based preemption.
Returns 0 on success, or an error code specified in <oskit/error.h>, on error.