From 8f28fa5569f56cb2575ffb9c640d4baa732fe5bd Mon Sep 17 00:00:00 2001 From: chen Date: Tue, 6 Sep 2022 14:27:48 +0800 Subject: [PATCH] modify thread_create param Signed-off-by: chen Change-Id: I106443ffd55a4abe659ef4888a6b6ce4e5ebb2ce --- samgr/adapter/posix/thread_adapter.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/samgr/adapter/posix/thread_adapter.c b/samgr/adapter/posix/thread_adapter.c index adf7cb3..eda4087 100755 --- a/samgr/adapter/posix/thread_adapter.c +++ b/samgr/adapter/posix/thread_adapter.c @@ -70,14 +70,13 @@ ThreadId THREAD_Create(Runnable run, void *argv, const ThreadAttr *attr) pthread_attr_t threadAttr; pthread_attr_init(&threadAttr); pthread_attr_setstacksize(&threadAttr, (attr->stackSize | MIN_STACK_SIZE)); -#ifdef SAMGR_LINUX_ADAPTER - struct sched_param sched = {attr->priority}; -#else + +#ifndef SAMGR_LINUX_ADAPTER struct sched_param sched = {PRI_BUTT - attr->priority}; -#endif - pthread_attr_setinheritsched(&threadAttr, PTHREAD_EXPLICIT_SCHED); pthread_attr_setschedpolicy(&threadAttr, SCHED_RR); pthread_attr_setschedparam(&threadAttr, &sched); +#endif + pthread_attr_setinheritsched(&threadAttr, PTHREAD_EXPLICIT_SCHED); (void) pthread_once(&g_localKeyOnce, KeyCreate); pthread_t threadId = 0; int errno = pthread_create(&threadId, &threadAttr, run, argv); -- Gitee