summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/barriercreate.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-02-21 10:21:26 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-02-24 09:22:36 +0100
commit3cbdf19eacf45a8e9faad284b71775a9d56872dd (patch)
tree1fe6c02e117ac4a09379da1403724d66fc97a58c /cpukit/rtems/src/barriercreate.c
parentscore: Remove _Objects_Open() (diff)
downloadrtems-3cbdf19eacf45a8e9faad284b71775a9d56872dd.tar.bz2
score: Simplify core barrier
Use the number of threads which must arrive at the barrier to trip the automatic release also to indicate if the barrier is a manual release barrier.
Diffstat (limited to '')
-rw-r--r--cpukit/rtems/src/barriercreate.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/cpukit/rtems/src/barriercreate.c b/cpukit/rtems/src/barriercreate.c
index 99d916d8c7..80b10e1e0b 100644
--- a/cpukit/rtems/src/barriercreate.c
+++ b/cpukit/rtems/src/barriercreate.c
@@ -34,34 +34,35 @@ rtems_status_code rtems_barrier_create(
rtems_id *id
)
{
- Barrier_Control *the_barrier;
- CORE_barrier_Attributes the_attributes;
+ Barrier_Control *the_barrier;
+ uint32_t maximum_count;
- if ( !rtems_is_name_valid( name ) )
+ if ( !rtems_is_name_valid( name ) ) {
return RTEMS_INVALID_NAME;
+ }
- if ( !id )
+ if ( id == NULL ) {
return RTEMS_INVALID_ADDRESS;
+ }
- /* Initialize core barrier attributes */
if ( _Attributes_Is_barrier_automatic( attribute_set ) ) {
- the_attributes.discipline = CORE_BARRIER_AUTOMATIC_RELEASE;
- if ( maximum_waiters == 0 )
+ if ( maximum_waiters == 0 ) {
return RTEMS_INVALID_NUMBER;
- } else
- the_attributes.discipline = CORE_BARRIER_MANUAL_RELEASE;
- the_attributes.maximum_count = maximum_waiters;
+ }
+
+ maximum_count = maximum_waiters;
+ } else {
+ maximum_count = CORE_BARRIER_MANUAL_RELEASE_MAXIMUM_COUNT;
+ }
the_barrier = _Barrier_Allocate();
- if ( !the_barrier ) {
+ if ( the_barrier == NULL ) {
_Objects_Allocator_unlock();
return RTEMS_TOO_MANY;
}
- the_barrier->attribute_set = attribute_set;
-
- _CORE_barrier_Initialize( &the_barrier->Barrier, &the_attributes );
+ _CORE_barrier_Initialize( &the_barrier->Barrier, maximum_count );
*id = _Objects_Open_u32( &_Barrier_Information, &the_barrier->Object, name );
_Objects_Allocator_unlock();