unvo Опубликовано 2 января, 2007 Жалоба Опубликовано 2 января, 2007 Работая под Linux (Redhat), пытаюсь изменить приоритет потока. Делаю это так: #include <pthread.h> #include <stdio.h> static void *my_thread(void *arg) { sleep(1); } int main(void) { pthread_t thread; int priority; int policy; struct sched_param param; int res; pthread_create(&thread, NULL, my_thread, NULL); res = pthread_getschedparam(thread, &policy, ¶m); priority = param.sched_priority; printf("res = %d policy = %d priority = %d\n", res, policy, priority); param.sched_priority = 2; policy = SCHED_OTHER; res = pthread_setschedparam(thread, policy, ¶m); printf("res = %d\n", res); pthread_join(thread, 0); return 0; } В результате получаю: res = 0 policy = 0 priority = 0 res = 22 Что делаю не так? Цитата
Рекомендуемые сообщения
Присоединяйтесь к обсуждению
Вы можете написать сейчас и зарегистрироваться позже. Если у вас есть аккаунт, авторизуйтесь, чтобы опубликовать от имени своего аккаунта.