Changeset 8230a329 in rtems


Ignore:
Timestamp:
Sep 15, 2017, 11:24:51 AM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
c030edd
Parents:
3b47ce7
git-author:
Sebastian Huber <sebastian.huber@…> (09/15/17 11:24:51)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/15/17 11:57:53)
Message:

posix: Allow PTHREAD_PROCESS_SHARED for barriers

Close #3126.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/src/pbarrierinit.c

    r3b47ce7 r8230a329  
    2626#include <rtems/system.h>
    2727#include <rtems/posix/barrierimpl.h>
     28#include <rtems/posix/posixapi.h>
    2829
    2930/*
     
    7980    return EINVAL;
    8081
    81   switch ( the_attr->process_shared ) {
    82     case PTHREAD_PROCESS_PRIVATE:    /* only supported values */
    83       break;
    84     case PTHREAD_PROCESS_SHARED:
    85     default:
    86       return EINVAL;
     82  if ( !_POSIX_Is_valid_pshared( the_attr->process_shared ) ) {
     83    return EINVAL;
    8784  }
    8885
  • testsuites/psxtests/psxbarrier01/psxbarrier01.scn

    r3b47ce7 r8230a329  
    1 *** POSIX BARRIER TEST 01 ***
     1*** BEGIN OF TEST PSXBARRIER 1 ***
    22pthread_barrierattr_init( NULL ) -- EINVAL
    33pthread_barrierattr_setpshared( NULL, private ) -- EINVAL
     
    2020pthread_barrierattr_init( &attr ) -- OK
    2121pthread_barrier_init( &barrier, &attr, 0 ) -- EINVAL
     22pthread_barrier_init( &barrier, &attr, 1 ) -- EINVAL
     23pthread_barrierattr_setpshared( &attr, shared ) -- OK
     24pthread_barrier_init( &barrier, &attr, 1 ) -- OK
     25pthread_barrier_destroy( &barrier ) -- OK
    2226pthread_barrier_init( &barrier, NULL, 1 ) -- OK
    2327pthread_barrier_init( &barrier, NULL, 1 ) -- EAGAIN
     
    3943pthread_barrier_wait - 0x0b010002 released
    4044pthread_barrier_wait - 0x0b010001 released
    41 *** END OF POSIX BARRIER TEST 01 ***
     45*** END OF TEST PSXBARRIER 1 ***
  • testsuites/psxtests/psxbarrier01/test.c

    r3b47ce7 r8230a329  
    162162  rtems_test_assert( status == EINVAL );
    163163
     164  puts( "pthread_barrier_init( &barrier, &attr, 1 ) -- EINVAL" );
     165  attr.process_shared = -1;
     166  status = pthread_barrier_init( &barrier, &attr, 1 );
     167  rtems_test_assert( status == EINVAL );
     168
     169  puts( "pthread_barrierattr_setpshared( &attr, shared ) -- OK" );
     170  status = pthread_barrierattr_setpshared( &attr, PTHREAD_PROCESS_SHARED );
     171  rtems_test_assert( status == 0 );
     172
     173  puts( "pthread_barrier_init( &barrier, &attr, 1 ) -- OK" );
     174  status = pthread_barrier_init( &barrier, &attr, 1 );
     175  rtems_test_assert( status == 0 );
     176
     177  puts( "pthread_barrier_destroy( &barrier ) -- OK" );
     178  status = pthread_barrier_destroy( &barrier );
     179  rtems_test_assert( status == 0 );
     180
    164181  /* allocating too many */
    165182  puts( "pthread_barrier_init( &barrier, NULL, 1 ) -- OK" );
Note: See TracChangeset for help on using the changeset viewer.