[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1

pthread_condattr_setpshared Subroutine

Purpose

Sets the value of the pshared attribute of a condition attributes object.

Library

Threads Library (libpthreads.a)

Syntax

#include <pthread.h>

int pthread_condattr_setpshared (attr, pshared)
pthread_condattr_t *attr;
int pshared;

Description

The pthread_condattr_setpshared subroutine sets the value of the pshared attribute of the condition attributes object attr. This attribute specifies the process sharing of the condition variable 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. Otherwise, the -D_THREAD_SAFE compilation flag should be used, or the cc_r compiler used. In this case, the flag is automatically set.

Parameters

attr Specifies the condition attributes object.
pshared Specifies the process sharing to set. It must have one of the following values:
PTHREAD_PROCESS_SHARED
Specifies that the condition variable can be used by any thread that has access to the memory where it is allocated, even if these threads belong to different processes.
PTHREAD_PROCESS_PRIVATE
Specifies that the condition variable shall only be used by threads within the same process as the thread that created it. This is the default value.

Return Values

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

Error Codes

The pthread_condattr_setpshared subroutine is unsuccessful if the following is true:

EINVAL The attr or pshared parameters are not valid.

Related Information

The pthread_condattr_getpshared (pthread_condattr_getpshared Subroutine) subroutine, pthread_condattr_init or pthread_cond_init (pthread_condattr_destroy or pthread_condattr_init Subroutine) subroutine.

Advanced Attributes in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

Threads Library Options in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

Threads Library Quick Reference in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]