Bug 222202 - Error when creating new thread via thr_new and trying set it priority to RTP_PRIO_IDLE
Summary: Error when creating new thread via thr_new and trying set it priority to RTP_...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 11.1-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-threads (Nobody)
Depends on:
Reported: 2017-09-10 17:55 UTC by Emelyanov Roman
Modified: 2017-11-07 21:44 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Emelyanov Roman 2017-09-10 17:55:03 UTC
In file sys/kern/kern_thr.c in function thread_create when cheking parametr rtp for it validity, value RTP_PRIO_IDLE processed like incorrect and function return EINVAL. As i see it, this is a bug. Because it is possible setup any other sheduler priority, except RTP_PRIO_ITHD (what is logicaly).
Comment 1 Jilles Tjoelker freebsd_committer 2017-10-22 21:05:35 UTC
It looks like libthr does not have any support for RTP_PRIO_IDLE either. Perhaps this is because the risk of a non-idle thread getting blocked by an idle thread is high (for example, if an idle thread has locked data structures used by malloc()).

A workaround is possible by calling rtprio_thread() manually using the id from pthread_getthreadid_np().
Comment 2 Emelyanov Roman 2017-11-07 21:44:23 UTC
I write not about any libs, i write about syscall interface. Impossible to create new thread with priority that i like looks alogicaly. If we already have parameter that allow select wanted priority, so why we must use it ONLY for RT-class, but no for all others?

Workaround is very simple, but better if we can do it without any ugly crutches.