Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
sched.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018-2023 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef ZEPHYR_INCLUDE_POSIX_SCHED_H_
7#define ZEPHYR_INCLUDE_POSIX_SCHED_H_
8
9#include <zephyr/kernel.h>
10
11#include "posix_types.h"
12
13#include <time.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/*
20 * Other mandatory scheduling policy. Must be numerically distinct. May
21 * execute identically to SCHED_RR or SCHED_FIFO. For Zephyr this is a
22 * pseudonym for SCHED_RR.
23 */
24#define SCHED_OTHER 0
25
26/* Cooperative scheduling policy */
27#define SCHED_FIFO 1
28
29/* Priority based preemptive scheduling policy */
30#define SCHED_RR 2
31
32#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
33 || defined(CONFIG_ARCMWDT_LIBC)
34struct sched_param {
35 int sched_priority;
36};
37#endif
38
44static inline int sched_yield(void)
45{
46 k_yield();
47 return 0;
48}
49
50int sched_get_priority_min(int policy);
51int sched_get_priority_max(int policy);
52
53int sched_getparam(pid_t pid, struct sched_param *param);
55
56int sched_setparam(pid_t pid, const struct sched_param *param);
57int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param);
58int sched_rr_get_interval(pid_t pid, struct timespec *interval);
59
60#ifdef __cplusplus
61}
62#endif
63
64#endif /* ZEPHYR_INCLUDE_POSIX_SCHED_H_ */
void k_yield(void)
Yield the current thread.
Public kernel APIs.
int sched_setparam(pid_t pid, const struct sched_param *param)
int sched_rr_get_interval(pid_t pid, struct timespec *interval)
int sched_getparam(pid_t pid, struct sched_param *param)
int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param)
int sched_getscheduler(pid_t pid)
static int sched_yield(void)
Yield the processor.
Definition sched.h:44
int sched_get_priority_min(int policy)
int sched_get_priority_max(int policy)
int pid_t
Definition posix_types.h:67
Definition _timespec.h:22