From e89542069b17b03595a71f656a093c13f314dce0 Mon Sep 17 00:00:00 2001 From: jwx1265790 <2510840462@qq.com> Date: Fri, 4 Aug 2023 11:52:38 +0800 Subject: [PATCH] Fix testcase failed Issue: https://gitee.com/openharmony/third_party_musl/issues/I7PMQ5 test: libc-test Signed-off-by: jwx1265790 <2510840462@qq.com> --- .../supplement/thread/pthread_setschedparam.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libc-test/src/functionalext/supplement/thread/pthread_setschedparam.c b/libc-test/src/functionalext/supplement/thread/pthread_setschedparam.c index 51936526..c1793337 100644 --- a/libc-test/src/functionalext/supplement/thread/pthread_setschedparam.c +++ b/libc-test/src/functionalext/supplement/thread/pthread_setschedparam.c @@ -16,13 +16,16 @@ #include #include #include +#include #include "functionalext.h" static int32_t priorityTen = 10; static int32_t priorityHundred = 100; +static sem_t g_sem; void *threadfuncA(void *arg) { + sem_wait(&g_sem); return arg; } @@ -34,12 +37,16 @@ void *threadfuncA(void *arg) void pthread_setschedparam_0100(void) { pthread_t tid; + sem_init(&g_sem, 0, 0); pthread_create(&tid, NULL, threadfuncA, NULL); struct sched_param sched; sched.sched_priority = 0; int32_t ret = pthread_setschedparam(tid, SCHED_OTHER, &sched); EXPECT_EQ("pthread_setschedparam_0100", ret, 0); + int32_t semRet = sem_post(&g_sem); + EXPECT_EQ("pthread_setschedparam_0100", semRet, 0); pthread_join(tid, NULL); + sem_destroy(&g_sem); } int main(void) -- GitLab