Zephyr API Documentation 4.0.0-rc2
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>
11
12#include <time.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/*
19 * Other mandatory scheduling policy. Must be numerically distinct. May
20 * execute identically to SCHED_RR or SCHED_FIFO. For Zephyr this is a
21 * pseudonym for SCHED_RR.
22 */
23#define SCHED_OTHER 0
24
25/* Cooperative scheduling policy */
26#define SCHED_FIFO 1
27
28/* Priority based preemptive scheduling policy */
29#define SCHED_RR 2
30
31#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
32 || defined(CONFIG_ARCMWDT_LIBC)
33struct sched_param {
34 int sched_priority;
35};
36#endif
37
43static inline int sched_yield(void)
44{
45 k_yield();
46 return 0;
47}
48
49int sched_get_priority_min(int policy);
50int sched_get_priority_max(int policy);
51
52int sched_getparam(pid_t pid, struct sched_param *param);
54
55int sched_setparam(pid_t pid, const struct sched_param *param);
56int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param);
57int sched_rr_get_interval(pid_t pid, struct timespec *interval);
58
59#ifdef __cplusplus
60}
61#endif
62
63#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:43
int sched_get_priority_min(int policy)
int sched_get_priority_max(int policy)
int pid_t
Definition posix_types.h:79
Definition _timespec.h:22