pthread_barrierattr_getpshared(), pthread_barrierattr_setpshared()

get and set the process-shared attribute of the barrier attributes object 

Advanced Realtime Threads


SYNOPSIS

#include <pthread.h>

int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict attr, int *restrict pshared);

int pthread_barrierattr_setpshared(pthread_barrierattr_t *attr, int pshared);


DESCRIPTION

The pthread_barrierattr_getpshared() function gets the value of the process-shared attribute from the attributes object pointed to by the attr argument. The pthread_barrierattr_setpshared() function sets the process-shared attribute in an initialized attributes object pointed to by the attr argument.

Valid settings for the process-shared attribute include

PTHREAD_PROCESS_SHARED 

Permits any thread that can access the memory where a barrier is allocated to operate on that barrier.

PTHREAD_PROCESS_PRIVATE 

Permits only threads created within the same process as the thread that initialized a barrier to operate on that barrier.

By default, the process-shared attribute is set to PTHREAD_PROCESS_PRIVATE. Both constants PTHREAD_PROCESS_SHARED and PTHREAD_PROCESS_PRIVATE are defined in <pthread.h>.


PARAMETERS

attr 

Points to a barrier attributes object.

pshared 

For the pthread_barrier_getpshared(), this argument points to the location where the value of the process-shared attribute of attr is stored.

For the pthread_barrier_setpshared(), this argument is the value to be assigned to the process-shared attribute of attr is stored.


RETURN VALUES

When successful, the pthread_barrierattr_getpshared() function returns zero and stores the value of the process-shared attribute of attr in the object pointed to by the pshared parameter. Otherwise, it returns an error number to indicate the error.

When successful, the pthread_barrierattr_setpshared() function returns zero. Otherwise, it returns an error number to to indicate the error.

The error number returned by these functions can be one of the following:

EINVAL 

The attr argument points to an invalid value or the new value specified for the process-shared attribute is not PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE.

ENOTSUP 

The pshared argument was set to PTHREAD_PROCESS_SHARED.


CONFORMANCE

UNIX 03.


MULTITHREAD SAFETY LEVEL

MT-safe.


PORTING ISSUES

The PTHREAD_PROCESS_SHARED process-shared state is not currently supported; if this value is specified, the function returns ENOTSUP.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
pthread_barrier_destroy(), pthread_barrierattr_destroy(), pthread_barrierattr_init()


PTC MKS Toolkit 10.4 Documentation Build 39.