On 2010/09/23 11:25, Edd Barrett wrote:
> > > >
> > > > Where did the magical numbers 0 and 31 come from?:
> > > > + minPriority = 0;
> > > > + maxPriority = 31;
> > > > [..]
> > >
> > > egrep -r "PTHREAD_M(IN|AX)_PRIORITY"
> > > /usr/src//lib/libpthread/uthread/*.h
> >
> > Of course, but I think the point was whether we wanted to use values
> > from private headers since PTHREAD_M(IN|AX)_PRIORITY is not accessible
> > from /usr/include.
>
> I'm still confused as to what level of support OpenBSD has for thread
> priorities. Setting both min and max to 0 breaks mediatomb, so they must
> be supported in some fashion.
we have support for thread priorities, see src/lib/libpthread/uthread/
and pthreads(3), just not the sched_get_priority_*() functions.
it might make sense to add them though, we have patches in a few
ports for this:
$ find . -type d -and -path '*/patches' -print0 | xargs -0 grep -ER
'(sched_get_priority|_POSIX_THREAD_PRIORITY_SCHEDULING)'
./audio/daapd/patches/patch-daapd_cc:-#if defined(
_POSIX_THREAD_PRIORITY_SCHEDULING)
./audio/daapd/patches/patch-daapd_cc:+#if defined(
_POSIX_THREAD_PRIORITY_SCHEDULING) && !defined(__OpenBSD__)
./devel/nspr/patches/patch-mozilla_nsprpub_pr_src_pthreads_ptthread_c:+#undef
_POSIX_THREAD_PRIORITY_SCHEDULING
./devel/nspr/patches/patch-mozilla_nsprpub_pr_src_pthreads_ptthread_c: /* In
Open C sched_get_priority_min/max do not work properly, so we undefine
./emulators/BasiliskII/patches/patch-src_Unix_main_unix_cpp:+#undef
_POSIX_THREAD_PRIORITY_SCHEDULING
./emulators/BasiliskII/patches/patch-src_Unix_main_unix_cpp: #if
defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
./multimedia/xine-lib/patches/patch-src_xine-engine_audio_decoder_c: #ifdef
_POSIX_THREAD_PRIORITY_SCHEDULING
./multimedia/xine-lib/patches/patch-src_xine-engine_audio_decoder_c:
pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER);
./multimedia/xine-lib/patches/patch-src_xine-engine_video_decoder_c: #ifdef
_POSIX_THREAD_PRIORITY_SCHEDULING
./multimedia/xine-lib/patches/patch-src_xine-engine_video_decoder_c:
pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER);
./multimedia/xine-ui/patches/patch-src_xitk_panel_c: #ifdef
_POSIX_THREAD_PRIORITY_SCHEDULING
./multimedia/xine-ui/patches/patch-src_xitk_panel_c:
pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER);
./multimedia/xine-ui/patches/patch-src_xitk_xine-toolkit_label_c: #ifdef
_POSIX_THREAD_PRIORITY_SCHEDULING
./multimedia/xine-ui/patches/patch-src_xitk_xine-toolkit_label_c:
pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER);
./multimedia/xine-ui/patches/patch-src_xitk_xine-toolkit_tips_c: #ifdef
_POSIX_THREAD_PRIORITY_SCHEDULING
./multimedia/xine-ui/patches/patch-src_xitk_xine-toolkit_tips_c:
pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER);
./multimedia/mediatomb/patches/patch-tombupnp_threadutil_src_ThreadPool_c:
minPriority = sched_get_priority_min( currentPolicy );
./multimedia/mediatomb/patches/patch-tombupnp_threadutil_src_ThreadPool_c:
maxPriority = sched_get_priority_max( currentPolicy );
./net/poco/patches/patch-Foundation_src_Thread_POSIX_cpp: return
sched_get_priority_min(SCHED_OTHER);
./net/poco/patches/patch-Foundation_src_Thread_POSIX_cpp: return
sched_get_priority_max(SCHED_OTHER);
./telephony/iaxclient/patches/patch-lib_unixfuncs_c:we do not have
sched_get_priority_{min/max}, fix was inspired by patch to pjsua
./telephony/iaxclient/patches/patch-lib_unixfuncs_c:- maxPri =
sched_get_priority_max(SCHEDULER_POLICY);
./telephony/iaxclient/patches/patch-lib_unixfuncs_c:+// maxPri =
sched_get_priority_max(SCHEDULER_POLICY);
./telephony/iaxclient/patches/patch-lib_unixfuncs_c:- b->priority =
(sched_get_priority_max(SCHEDULER_POLICY) -
./telephony/iaxclient/patches/patch-lib_unixfuncs_c:-
sched_get_priority_min(SCHEDULER_POLICY)) / 2;
./telephony/iaxclient/patches/patch-lib_unixfuncs_c:+// b->priority =
(sched_get_priority_max(SCHEDULER_POLICY) -
./telephony/iaxclient/patches/patch-lib_unixfuncs_c:+//
sched_get_priority_min(SCHEDULER_POLICY)) / 2;