pthread_mutexattr_setprotocol Subroutine



Purpose

Sets the value of the protocol attribute of a mutex attributes object.

Library

Threads Library (libpthreads.a)

Syntax

#include 

int pthread_mutexattr_setprotocol (attr, protocol)
pthread_mutexattr_t *attr;
int protocol;

Description

The pthread_mutexattr_setprotocol subroutine sets the value of the
protocol attribute of the mutex attributes object attr. This attribute
specifies the protocol used to prevent priority inversions for the
mutex created with this attributes object.

Note:	The pthread.h header file must be the first included file of
each source file using the threads library.

Parameters

attr	Specifies the mutex attributes object.

protocol	Specifies the protocol to set. It must have one of the following
values:

PTHREAD_PRIO_NONE	Denotes no protocol. This is the default value.

PTHREAD_PRIO_INHERIT	Denotes priority inheritance protocol. It is
only available if the _POSIX_THREAD_PRIO_INHERIT symbol is defined.
Otherwise, it is not supported.

PTHREAD_PRIO_PROTECT	Denotes priority protection protocol. It is only
available if the _POSIX_THREAD_PRIO_PROTECT symbol is defined. Otherwise,
it is not supported.

Return Values

Upon successful completion, 0 is returned. Otherwise, an error code
is returned.

Error Codes

The pthread_mutexattr_setprotocol subroutine is unsuccessful if the
following is true:

EINVAL	The attr parameter is not valid.

ENOSYS	Both priority inheritance and priority protection POSIX options
are not implemented.

ENOTSUP	The value of the protocol parameter is not supported.

EPERM	The calling thread does not have sufficient privilege to perform
the operation.

Implementation Specifics

This subroutine is part of the Base Operating System (BOS) Runtime.

The implementation of this subroutine is dependent on the priority
inheritance or priority protection POSIX option. Both priority inheritance
and priority protection POSIX options are not implemented in the current
version of AIX.

Related Information

The pthread_mutexattr_getprotocol subroutine, pthread_mutexattr_init
subroutine, pthread_mutex_init subroutine.

Synchronization Scheduling.

Threads Library Options and Threads Library Quick Reference.