1570af302Sopenharmony_ci#include "pthread_impl.h" 2570af302Sopenharmony_ci#include "lock.h" 3570af302Sopenharmony_ci#ifndef __LITEOS__ 4570af302Sopenharmony_ci#include "param_check.h" 5570af302Sopenharmony_ci#endif 6570af302Sopenharmony_ci 7570af302Sopenharmony_ciint pthread_setschedparam(pthread_t t, int policy, const struct sched_param *param) 8570af302Sopenharmony_ci{ 9570af302Sopenharmony_ci int r; 10570af302Sopenharmony_ci sigset_t set; 11570af302Sopenharmony_ci#ifndef __LITEOS__ 12570af302Sopenharmony_ci PARAM_CHECK(t); 13570af302Sopenharmony_ci#endif 14570af302Sopenharmony_ci __block_app_sigs(&set); 15570af302Sopenharmony_ci LOCK(t->killlock); 16570af302Sopenharmony_ci#ifdef __LITEOS_A__ 17570af302Sopenharmony_ci r = !t->tid ? ESRCH : -__syscall(SYS_sched_setscheduler, t->tid, policy, param, MUSL_TYPE_THREAD); 18570af302Sopenharmony_ci#else 19570af302Sopenharmony_ci r = !t->tid ? ESRCH : -__syscall(SYS_sched_setscheduler, t->tid, policy, param); 20570af302Sopenharmony_ci#endif 21570af302Sopenharmony_ci UNLOCK(t->killlock); 22570af302Sopenharmony_ci __restore_sigs(&set); 23570af302Sopenharmony_ci return r; 24570af302Sopenharmony_ci} 25