Add tests for posix scheduling apis to configure.ac and use them to determine

if we should set scheduling priorities or not.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2277 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Steven Dake 2009-06-21 16:33:25 +00:00
parent cbb6aaf78b
commit 0cf6c6c7db
5 changed files with 10 additions and 4 deletions

View File

@ -104,7 +104,8 @@ AC_CHECK_FUNCS([alarm alphasort atexit bzero dup2 endgrent endpwent fcntl \
getcwd getpeerucred getpeereid gettimeofday inet_ntoa memmove \
memset mkdir scandir select socket strcasecmp strchr strdup \
strerror strrchr strspn strstr pthread_spin_lock \
pthread_spin_unlock])
pthread_spin_unlock pthread_setschedparam \
sched_get_priority_max])
# add man and init dirs?
AC_CONFIG_FILES([Makefile

View File

@ -528,10 +528,12 @@ static void *pthread_ipc_consumer (void *conn)
int send_ok;
unsigned int new_message;
#if defined(HAVE_PTHREAD_SETSCHEDPARAM) && defined(HAVE_SCHED_GET_PRIORITY_MAX)
if (api->sched_policy != 0) {
res = pthread_setschedparam (conn_info->thread,
api->sched_policy, api->sched_param);
}
#endif
for (;;) {
sop.sem_num = 0;

View File

@ -1609,9 +1609,11 @@ int logsys_thread_priority_set (
{
int res = 0;
#if defined(HAVE_PTHREAD_SETSCHEDPARAM) && defined(HAVE_SCHED_GET_PRIORITY_MAX)
if (policy != SCHED_OTHER) {
res = pthread_setschedparam (logsys_thread_id, policy, param);
}
#endif
if (after_log_ops_yield > 0) {
logsys_after_log_ops_yield = after_log_ops_yield;
}

View File

@ -326,7 +326,7 @@ static void corosync_tty_detach (void)
static void corosync_setscheduler (void)
{
#if ! defined(TS_CLASS) && (defined(COROSYNC_BSD) || defined(COROSYNC_LINUX) || defined(COROSYNC_SOLARIS))
#if defined(HAVE_PTHREAD_SETSCHEDPARAM) && defined(HAVE_SCHED_GET_PRIORITY_MAX)
int res;
sched_priority = sched_get_priority_max (SCHED_RR);
@ -342,7 +342,8 @@ static void corosync_setscheduler (void)
sched_priority = 0;
}
#else
log_printf(LOGSYS_LEVEL_WARNING, "Scheduler priority left to default value (no OS support)\n");
log_printf(LOGSYS_LEVEL_WARNING,
"The Platform is missing process priority setting features. Leaving at default.");
#endif
}

View File

@ -107,7 +107,7 @@ static void *prioritized_timer_thread (void *data)
int fds;
unsigned long long timeout;
#if ! defined(TS_CLASS) && (defined(COROSYNC_BSD) || defined(COROSYNC_LINUX) || defined(COROSYNC_SOLARIS))
#if defined(HAVE_PTHREAD_SETSCHEDPARAM) && defined(HAVE_SCHED_GET_PRIORITY_MAX)
if (sched_priority != 0) {
struct sched_param sched_param;