Visit The New, Modern Unix Linux Community

Linux and UNIX Man Pages

Test Your Knowledge in Computers #271
Difficulty: Easy
While working at Bletchley Park, in the first week of June each year Alan Turing would get a bad attack of hay fever, and he would cycle to the office wearing a service gas mask to keep from breathing pollen. In the first week of June each year he would get a bad attack of hay fever, and he would cycle to the office wearing a service gas mask to keep from breathing the pollen.
True or False?
Linux & Unix Commands - Search Man Pages

pthread_barrierattr_getpshared(3) [freebsd man page]

PTHREAD_BARRIERATTR(3)					   BSD Library Functions Manual 				    PTHREAD_BARRIERATTR(3)

NAME
pthread_barrierattr_destroy, pthread_barrierattr_getpshared, pthread_barrierattr_init, pthread_barrierattr_setpshared -- manipulate a barrier attribute object LIBRARY
POSIX Threads Library (libpthread, -lpthread) SYNOPSIS
#include <pthread.h> int pthread_barrierattr_destroy(pthread_barrierattr_t *attr); int pthread_barrierattr_getpshared(const pthread_barrierattr_t *attr, int *pshared); int pthread_barrierattr_init(pthread_barrierattr_t *attr); int pthread_barrierattr_setpshared(pthread_barrierattr_t *attr, int pshared); DESCRIPTION
The pthread_barrierattr_init() function will initialize attr with default attributes. The pthread_barrierattr_destroy() function will destroy attr and release any resources that may have been allocated on its behalf. The pthread_barrierattr_getpshared() function will put the value of the process-shared attribute from attr into the memory area pointed to by pshared. The pthread_barrierattr_setpshared() function will set the process-shared attribute of attr to the value specified in pshared. The argument pshared may have one of the following values: PTHREAD_PROCESS_PRIVATE The barrier object it is attached to may only be accessed by threads in the same process as the one that created the object. PTHREAD_PROCESS_SHARED The barrier object it is attached to may be accessed by threads in processes other than the one that created the object. RETURN VALUES
If successful, all these functions will return zero. Otherwise, an error number will be returned to indicate the error. None of these functions will return EINTR. ERRORS
The pthread_barrierattr_destroy(), pthread_barrierattr_getpshared() and pthread_barrierattr_setpshared() functions may fail if: [EINVAL] The value specified by attr is invalid. The pthread_barrierattr_init() function will fail if: [ENOMEM] Insufficient memory to initialize the barrier attribute object attr. The pthread_barrierattr_setpshared() function will fail if: [EINVAL] The value specified in pshared is not one of the allowed values. SEE ALSO
pthread_barrier_destroy(3), pthread_barrier_init(3), pthread_barrier_wait(3) HISTORY
The pthread_barrierattr_*() functions first appeared in N:M Threading Library (libkse, -lkse) in FreeBSD 5.2, and in 1:1 Threading Library (libthr, -lthr) in FreeBSD 5.3. BUGS
The implementation of barriers does not fully conform to IEEE Std 1003.2 (``POSIX.2'') because the process-shared attribute is ignored in 1:1 Threading Library (libthr, -lthr), and in N:M Threading Library (libkse, -lkse); if any value other than PTHREAD_PROCESSES_PRIVATE is speci- fied in a call to pthread_barrierattr_setpshared(), it will return EINVAL. BSD
February 19, 2004 BSD

Check Out this Related Man Page

pthread_barrierattr_getpshared(3C)			   Standard C Library Functions 			pthread_barrierattr_getpshared(3C)

NAME
pthread_barrierattr_getpshared, pthread_barrierattr_setpshared - get and set process-shared attribute of barrier attributes object SYNOPSIS
cc -mt [ flag... ] file... [ library... ] #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 obtains the value of the process-shared attribute from the attributes object referenced by attr. The pthread_barrierattr_setpshared() function sets the process-shared attribute in an initialized attributes object referenced by attr. The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit a barrier to be operated upon by any thread that has access to the memory where the barrier is allocated. If the process-shared attribute is PTHREAD_PROCESS_PRIVATE, the barrier will only be operated upon by threads created within the same process as the thread that initialized the barrier. If threads of different processes attempt to operate on such a barrier, the behavior is undefined. The default value of the attribute is PTHREAD_PROCESS_PRIVATE. Both constants PTHREAD_PROCESS_SHARED and PTHREAD_PROCESS_PRIVATE are defined in <pthread.h>. No barrier attributes other than the process-shared attribute are provided. RETURN VALUES
Upon successful completion, the pthread_barrierattr_getpshared() function returns 0 and stores the value of the process-shared attribute of attr into the object referenced by the pshared parameter. Otherwise, an error number is returned to indicate the error. Upon successful completion, the pthread_barrierattr_setpshared() function returns 0. Otherwise, an error number is returned to indicate the error. ERRORS
These functions may fail if: EINVAL The value specified by attr is invalid. The pthread_barrierattr_setpshared() function may fail if: EINVAL The new value specified for the process-shared attribute is not one of the legal values PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
pthread_barrier_init(3C), pthread_barrierattr_destroy(3C), attributes(5), standards(5) SunOS 5.10 30 Jan 2004 pthread_barrierattr_getpshared(3C)

Featured Tech Videos