pthread_mutexattr_setpshared

PTHREAD_MUTEXATTR_GETPSHARELinux Programmer's MPTHREAD_MUTEXATTR_GETPSHARED(3)

NAME
       pthread_mutexattr_getpshared,  pthread_mutexattr_setpshared  -  get/set
       process-shared mutex attribute

SYNOPSIS
       #include <pthread.h>

       int pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr,
                                        int *pshared);
       int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr,
                                        int pshared);

       Compile and link with -pthread.

DESCRIPTION
       These functions get and set the process-shared attribute in a mutex at-
       tributes  object.   This  attribute must be appropriately set to ensure
       correct, efficient operation of a mutex created using  this  attributes
       object.

       The process-shared attribute can have one of the following values:

       PTHREAD_PROCESS_PRIVATE
              Mutexes  created  with  this  attributes object are to be shared
              only among threads in the same process that initialized the  mu-
              tex.  This is the default value for the process-shared mutex at-
              tribute.

       PTHREAD_PROCESS_SHARED
              Mutexes created with this attributes object can  be  shared  be-
              tween  any threads that have access to the memory containing the
              object, including threads in different processes.

       pthread_mutexattr_getpshared() places the value of  the  process-shared
       attribute of the mutex attributes object referred to by attr in the lo-
       cation pointed to by pshared.

       pthread_mutexattr_setpshared() sets the value of the process-shared at-
       tribute of the mutex attributes object referred to by attr to the value
       specified in pshared.

       If attr does not refer to an initialized mutex attributes  object,  the
       behavior is undefined.

RETURN VALUE
       On success, these functions return 0.  On error, they return a positive
       error number.

ERRORS
       pthread_mutexattr_setpshared() can fail with the following errors:

       EINVAL The value specified in pshared is invalid.

       ENOTSUP
              pshared is PTHREAD_PROCESS_SHARED but  the  implementation  does
              not support process-shared mutexes.

CONFORMING TO
       POSIX.1-2001, POSIX.1-2008.

SEE ALSO
       pthread_mutexattr_init(3), pthreads(7)

COLOPHON
       This page is part of release 5.05 of the Linux man-pages project.  A
       description of the project, information about reporting bugs, and the
       latest version of this page, can be found at
       https://www.kernel.org/doc/man-pages/.

Linux                             2017-09-13   PTHREAD_MUTEXATTR_GETPSHARED(3)
Man Pages Copyright Respective Owners. Site Copyright (C) 1994 - 2024 Hurricane Electric. All Rights Reserved.