epicPosicMutexInit: avoid calling with 0 which is platform dependent
Different platforms (RTEMS5) can define different values for PTHREAD_MUTEX_DEFAULT, so we shouldn't pass 0 assuming its PTHREAD_MUTEX_DEFAULT.
This commit is contained in:
committed by
Michael Davidsaver
parent
f9e3e86401
commit
f41276bef8
@@ -51,7 +51,7 @@ LIBCOM_API epicsEventId epicsEventCreate(epicsEventInitialState init)
|
||||
epicsEventId pevent = malloc(sizeof(*pevent));
|
||||
|
||||
if (pevent) {
|
||||
int status = osdPosixMutexInit(&pevent->mutex, 0);
|
||||
int status = osdPosixMutexInit(&pevent->mutex, PTHREAD_MUTEX_DEFAULT);
|
||||
|
||||
pevent->isFull = (init == epicsEventFull);
|
||||
if (status) {
|
||||
|
||||
@@ -18,7 +18,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Returns ENOTSUP if requested mutextype is not supported */
|
||||
/* At the moment, only 0 (default non recursive mutex) and PTHREAD_MUTEX_RECURSIVE are supported */
|
||||
/* At the moment, only PTHREAD_MUTEX_DEFAULT and PTHREAD_MUTEX_RECURSIVE are supported */
|
||||
int osdPosixMutexInit(pthread_mutex_t *,int mutextype);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -123,7 +123,7 @@ epicsSpinId epicsSpinCreate(void) {
|
||||
if (!spin)
|
||||
goto fail;
|
||||
|
||||
status = osdPosixMutexInit(&spin->lock, 0);
|
||||
status = osdPosixMutexInit(&spin->lock, PTHREAD_MUTEX_DEFAULT);
|
||||
checkStatus(status, "osdPosixMutexInit");
|
||||
if (status)
|
||||
goto fail;
|
||||
|
||||
@@ -328,9 +328,9 @@ static void once(void)
|
||||
int status;
|
||||
|
||||
pthread_key_create(&getpthreadInfo,0);
|
||||
status = osdPosixMutexInit(&onceLock,0);
|
||||
status = osdPosixMutexInit(&onceLock,PTHREAD_MUTEX_DEFAULT);
|
||||
checkStatusOnceQuit(status,"osdPosixMutexInit","epicsThreadInit");
|
||||
status = osdPosixMutexInit(&listLock,0);
|
||||
status = osdPosixMutexInit(&listLock,PTHREAD_MUTEX_DEFAULT);
|
||||
checkStatusOnceQuit(status,"osdPosixMutexInit","epicsThreadInit");
|
||||
pcommonAttr = calloc(1,sizeof(commonAttr));
|
||||
if(!pcommonAttr) checkStatusOnceQuit(errno,"calloc","epicsThreadInit");
|
||||
|
||||
Reference in New Issue
Block a user