4
내 응용 프로그램에서 주 스레드보다 높은 우선 순위로 실행해야하는 도우미 pthread를 만듭니다. 부모 스레드에 비해 자식 pthread의 우선 순위를 높이는 방법
는이 같은 생성 된 스레드의 우선 순위 설정하려고 :struct sched_param param;
pthread_attr_t tattr;
pthread_attr_init(&tattr);
pthread_attr_getschedparam(&tattr, ¶m);
param.sched_priority = sched_get_priority_max(SCHED_RR);
pthread_attr_setschedparam(&tattr, ¶m);
pthread_create(&helper_thread, &tattr, helper_main, NULL);
을하지만 pthread_attr_setschedparam
호출은 EINVAL을 반환합니다.
내가 잘못하고있는 것이 확실하지 않습니다. 이것이 올바른 일반적인 접근법입니까?
어떻게 처리되는지는 신경 쓰지 않아요. 새 스레드가 원래 스레드보다 우선 순위가 높을 필요가 있습니다.
달기 덕분에 감사합니다. –