1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief RTEMS Barrier Release |
---|
5 | * @ingroup ClassicBarrier Barriers |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2007. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/system.h> |
---|
22 | #include <rtems/rtems/status.h> |
---|
23 | #include <rtems/rtems/support.h> |
---|
24 | #include <rtems/rtems/barrierimpl.h> |
---|
25 | #include <rtems/score/thread.h> |
---|
26 | |
---|
27 | /* |
---|
28 | * rtems_barrier_release |
---|
29 | * |
---|
30 | * This directive releases all threads waiting at a barrier. |
---|
31 | * |
---|
32 | * Input parameters: |
---|
33 | * id - barrier id |
---|
34 | * released - pointer to number of threads unblocked |
---|
35 | * |
---|
36 | * Output parameters: |
---|
37 | * RTEMS_SUCCESSFUL - if successful |
---|
38 | * error code - if unsuccessful |
---|
39 | * *released - number of threads unblocked |
---|
40 | */ |
---|
41 | |
---|
42 | rtems_status_code rtems_barrier_release( |
---|
43 | rtems_id id, |
---|
44 | uint32_t *released |
---|
45 | ) |
---|
46 | { |
---|
47 | Barrier_Control *the_barrier; |
---|
48 | Objects_Locations location; |
---|
49 | |
---|
50 | if ( !released ) |
---|
51 | return RTEMS_INVALID_ADDRESS; |
---|
52 | |
---|
53 | the_barrier = _Barrier_Get( id, &location ); |
---|
54 | switch ( location ) { |
---|
55 | |
---|
56 | case OBJECTS_LOCAL: |
---|
57 | *released = _CORE_barrier_Surrender( &the_barrier->Barrier, NULL, 0 ); |
---|
58 | _Objects_Put( &the_barrier->Object ); |
---|
59 | return RTEMS_SUCCESSFUL; |
---|
60 | |
---|
61 | #if defined(RTEMS_MULTIPROCESSING) |
---|
62 | case OBJECTS_REMOTE: |
---|
63 | #endif |
---|
64 | case OBJECTS_ERROR: |
---|
65 | break; |
---|
66 | } |
---|
67 | |
---|
68 | return RTEMS_INVALID_ID; |
---|
69 | } |
---|