From 162deed59530613431b06206352d80f958870305 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Fri, 15 Apr 2011 09:22:14 +0000 Subject: [PATCH] * thread.cc (pthread_setschedprio): New function. * include/pthread.h (pthread_setschedprio): Declare. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. * cygwin.din (pthread_setschedprio): Export. * posix.sgml (std-notimpl) Move pthread_setschedprio from here... (std-susv4) ...to here. --- winsup/cygwin/ChangeLog | 9 +++++++++ winsup/cygwin/cygwin.din | 1 + winsup/cygwin/include/cygwin/version.h | 3 ++- winsup/cygwin/include/pthread.h | 1 + winsup/cygwin/posix.sgml | 2 +- winsup/cygwin/thread.cc | 11 +++++++++++ 6 files changed, 25 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 7c71566e0..4caa5b8b0 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +2011-04-15 Yaakov Selkowitz + + * thread.cc (pthread_setschedprio): New function. + * include/pthread.h (pthread_setschedprio): Declare. + * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. + * cygwin.din (pthread_setschedprio): Export. + * posix.sgml (std-notimpl) Move pthread_setschedprio from here... + (std-susv4) ...to here. + 2011-04-10 Yaakov Selkowitz * fhandler_proc.cc (proc_tab): Add /proc/swaps virtual file. diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din index 10565adeb..d5edb2052 100644 --- a/winsup/cygwin/cygwin.din +++ b/winsup/cygwin/cygwin.din @@ -1241,6 +1241,7 @@ pthread_setcancelstate SIGFE pthread_setcanceltype SIGFE pthread_setconcurrency SIGFE pthread_setschedparam SIGFE +pthread_setschedprio SIGFE pthread_setspecific SIGFE pthread_sigmask SIGFE pthread_suspend SIGFE diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 58c55f6e3..072f62dcd 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -403,12 +403,13 @@ details. */ 237: Export strchrnul. 238: Export pthread_spin_destroy, pthread_spin_init, pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock. + 239: Export pthread_setschedprio. */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 238 +#define CYGWIN_VERSION_API_MINOR 239 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible diff --git a/winsup/cygwin/include/pthread.h b/winsup/cygwin/include/pthread.h index 10a53f3fd..221d242d3 100644 --- a/winsup/cygwin/include/pthread.h +++ b/winsup/cygwin/include/pthread.h @@ -194,6 +194,7 @@ pthread_t pthread_self (void); int pthread_setcancelstate (int, int *); int pthread_setcanceltype (int, int *); int pthread_setschedparam (pthread_t, int, const struct sched_param *); +int pthread_setschedprio (pthread_t, int); int pthread_setspecific (pthread_key_t, const void *); void pthread_testcancel (void); diff --git a/winsup/cygwin/posix.sgml b/winsup/cygwin/posix.sgml index 53e760633..d44f2bfd5 100644 --- a/winsup/cygwin/posix.sgml +++ b/winsup/cygwin/posix.sgml @@ -598,6 +598,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008). pthread_setcanceltype pthread_setconcurrency pthread_setschedparam + pthread_setschedprio pthread_setspecific pthread_sigmask pthread_spin_destroy @@ -1388,7 +1389,6 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008). pthread_mutex_timedlock pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock - pthread_setschedprio putmsg reminderl remquol diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 29674d4ed..87167b7f9 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -2306,6 +2306,17 @@ pthread_setschedparam (pthread_t thread, int policy, return rv; } +extern "C" int +pthread_setschedprio (pthread_t thread, int priority) +{ + if (!pthread::is_good_object (&thread)) + return ESRCH; + int rv = + sched_set_thread_priority (thread->win32_obj_id, priority); + if (!rv) + thread->attr.schedparam.sched_priority = priority; + return rv; +} extern "C" int pthread_setspecific (pthread_key_t key, const void *value)