summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2008-10-15 19:28:26 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2008-10-15 19:28:26 -0300
commite6fa9496f53503cd3f93d449f2a1d2b6047b7ac4 (patch)
tree7a3a6fa3d252a857dcdc406f08414bb45eacbb0b /include
parente405ab1626722125cd480a239a2c5a41414b141f (diff)
downloadmariadb-git-e6fa9496f53503cd3f93d449f2a1d2b6047b7ac4.tar.gz
Bug#38477: my_pthread_setprio can change dispatch class on Solaris, not just priority
The problem is that the function used by the server to increase the thread's priority (pthread_setschedparam) has the unintended side-effect of changing the calling thread scheduling policy, possibly overwriting a scheduling policy set by a sysadmin. The solution is to rely on the pthread_setschedprio function, if available, as it only changes the scheduling priority and does not change the scheduling policy. This function is usually available on Solaris and Linux, but it use won't work by default on Linux as the the default scheduling policy only accepts a static priority 0 -- this is acceptable for now as priority changing on Linux is broken anyway. configure.in: Check for the existence of the pthread_setschedprio function. include/my_pthread.h: Use the pthread_setschedprio function to set the thread priority if the function is available.
Diffstat (limited to 'include')
-rw-r--r--include/my_pthread.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h
index e56614357e0..151cb34faff 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -279,6 +279,8 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
#define my_pthread_setprio(A,B) pthread_setprio_np((A),(B))
#elif defined(HAVE_PTHREAD_SETPRIO)
#define my_pthread_setprio(A,B) pthread_setprio((A),(B))
+#elif defined(HAVE_PTHREAD_SETSCHEDPRIO)
+#define my_pthread_setprio(A,B) pthread_setschedprio((A),(B))
#else
extern void my_pthread_setprio(pthread_t thread_id,int prior);
#endif