From c24c38b084c13a2cdc5616f88bb5f63153600c28 Mon Sep 17 00:00:00 2001 From: lnlan Date: Tue, 27 Jul 2021 11:21:05 +0000 Subject: [PATCH] =?UTF-8?q?feat(kernel):=20=E8=A1=A5=E5=85=85=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=9C=80=E9=AB=98=E3=80=81=E6=9C=80=E4=BD=8E=E4=BC=98?= =?UTF-8?q?=E5=85=88=E7=BA=A7=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【背景】 补充获取最高、最低优先级接口 【修改方案】 pthread补充这两个接口 int sched_get_priority_min(int policy) int sched_get_priority_max(int policy) 【影响】 对现有的产品编译不会有影响。 re #I42HM7 Signed-off-by: lnlanc Change-Id: Id2ffc07e606ad497e8036f45dab1fa6a5ba981b3 --- kal/posix/src/pthread_attr.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/kal/posix/src/pthread_attr.c b/kal/posix/src/pthread_attr.c index d5e6d7b4..3caf5ea8 100644 --- a/kal/posix/src/pthread_attr.c +++ b/kal/posix/src/pthread_attr.c @@ -231,3 +231,23 @@ int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stackSize) return 0; } + +int sched_get_priority_min(int policy) +{ + if (policy != SCHED_RR) { + errno = EINVAL; + return -1; + } + + return LOS_TASK_PRIORITY_LOWEST; +} + +int sched_get_priority_max(int policy) +{ + if (policy != SCHED_RR) { + errno = EINVAL; + return -1; + } + + return LOS_TASK_PRIORITY_HIGHEST; +}