前言:
一个大型系统,有很多不同线程的业务,如何确保某些业务全部都被执行,这个时候就需要用到实时线程。
一,实现源码
-
pthread_attr_t attr;
-
struct sched_param param;
-
int newprio = 50;
-
-
pthread_attr_init(&attr);
-
pthread_attr_setschedpolicy(&attr, SCHED_RR);
-
pthread_attr_getschedparam(&attr, ¶m);
-
printf("-->default isp thread priority is %d , next be %d --<\n",
-
param.sched_priority, ;
-
param.sched_priority = newprio;
-
pthread_attr_setschedparam(&attr, ¶m);
-
-
if (0 != pthread_create(&gs_IspPid, &attr, (void*
-
(*)(void*))HI_MPI_ISP_Run,
-
{
-
printf("%s: create isp running thread failed!\n", __FUNCTION__);
-
return HI_FAILURE;
-
}
-
-
pthread_attr_destroy(&attr);
阅读(640) | 评论(0) | 转发(0) |