posix/osdMutex.c: print warning if PI envvar is set but PI not available or compiled in.

This commit is contained in:
till straumann
2020-08-17 14:28:06 +02:00
committed by Dirk Zimoch
parent 043595ca0a
commit 4b5d43b699

View File

@@ -15,7 +15,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <pthread.h>
@@ -66,22 +65,24 @@ static void setAttrDefaults(pthread_mutexattr_t *a)
status = pthread_mutexattr_init(a);
checkStatusQuit(status,"pthread_mutexattr_init","setAttrDefaults");
#if defined _POSIX_THREAD_PRIO_INHERIT
{
const char *p = envGetConfigParamPtr(&EPICS_MUTEX_USE_PRIORITY_INHERITANCE);
char c = p ? toupper(p[0]) : 'N';
if ( 'T' == c || 'Y' == c || '1' == c ) {
#if defined _POSIX_THREAD_PRIO_INHERIT
status = pthread_mutexattr_setprotocol(a, PTHREAD_PRIO_INHERIT);
if (errVerbose) checkStatus(status, "pthread_mutexattr_setprotocol(PTHREAD_PRIO_INHERIT)");
#ifndef HAVE_RECURSIVE_MUTEX
/* The implementation based on a condition variable below does not support
* priority-inheritance!
*/
epicsPrintf("WARNING: PRIORITY-INHERITANCE UNAVAILABLE for epicsMutex\n");
fprintf(stderr,"WARNING: PRIORITY-INHERITANCE UNAVAILABLE for epicsMutex\n");
#endif
#else
fprintf(stderr,"WARNING: PRIORITY-INHERITANCE UNAVAILABLE OR NOT COMPILED IN\n");
#endif
}
}
#endif
}