summaryrefslogblamecommitdiffstats
path: root/cpukit/posix/src/barrierattrsetpshared.c
blob: b22ba52fd40378e5b8529202a1c5336644bfb057 (plain) (tree)
1
2
3
4
5
6
7
8



                                                                            
                     

   
  




                                                           
                                         








                    




















                                     
/**
 *  @file
 *
 *  @brief Set the Process-Shared Attribute of the Barrier Attributes Object
 *  @ingroup POSIXAPI
 */

/*
 *  COPYRIGHT (c) 1989-2007.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.org/license/LICENSE.
 */

#if HAVE_CONFIG_H
#include "config.h"
#endif

#include <pthread.h>
#include <errno.h>

int pthread_barrierattr_setpshared(
  pthread_barrierattr_t *attr,
  int                    pshared
)
{
  if ( !attr )
    return EINVAL;

  if ( !attr->is_initialized )
    return EINVAL;

  switch ( pshared ) {
    case PTHREAD_PROCESS_SHARED:
    case PTHREAD_PROCESS_PRIVATE:
      attr->process_shared = pshared;
      return 0;

    default:
      return EINVAL;
  }
}