Name

NAME

pthread_mutexattr_getprotocol, pthread_mutexattr_setprotocol — get and set the protocol attribute of the mutex attributes object (REALTIME THREADS)

SYNOPSIS

THR     #include <pthread.h>

TPP|TPI int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *
            restrict attr,  int *restrict protocol);
        int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr,
            int protocol);

DESCRIPTION

The pthread_mutexattr_getprotocol() and pthread_mutexattr_setprotocol() functions, respectively, shall get and set the protocol attribute of a mutex attributes object pointed to by attr which was previously created by the function pthread_mutexattr_init().

The protocol attribute defines the protocol to be followed in utilizing mutexes. The value of protocol may be one of:

PTHREAD_PRIO_NONE

TPI PTHREAD_PRIO_INHERIT

TPP PTHREAD_PRIO_PROTECT

which are defined in the <pthread.h> header.

When a thread owns a mutex with the PTHREAD_PRIO_NONE protocol attribute, its priority and scheduling shall not be affected by its mutex ownership.

TPI When a thread is blocking higher priority threads because of owning one or more mutexes with the PTHREAD_PRIO_INHERIT protocol attribute, it shall execute at the higher of its priority or the priority of the highest priority thread waiting on any of the mutexes owned by this thread and initialized with this protocol.

TPP When a thread owns one or more mutexes initialized with the PTHREAD_PRIO_PROTECT protocol, it shall execute at the higher of its priority or the highest of the priority ...

Get Professional Multicore Programming: Design and Implementation for C++ Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.