1 | /* |
---|
2 | * SuperCore Barrier Handler |
---|
3 | * |
---|
4 | * DESCRIPTION: |
---|
5 | * |
---|
6 | * This package is part of the implementation of the SuperCore Barrier Handler. |
---|
7 | * |
---|
8 | * COPYRIGHT (c) 1989-2006. |
---|
9 | * On-Line Applications Research Corporation (OAR). |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in the file LICENSE in this distribution or at |
---|
13 | * http://www.rtems.com/license/LICENSE. |
---|
14 | * |
---|
15 | * $Id$ |
---|
16 | */ |
---|
17 | |
---|
18 | #if HAVE_CONFIG_H |
---|
19 | #include "config.h" |
---|
20 | #endif |
---|
21 | |
---|
22 | #include <rtems/system.h> |
---|
23 | #include <rtems/score/isr.h> |
---|
24 | #include <rtems/score/corebarrier.h> |
---|
25 | #include <rtems/score/states.h> |
---|
26 | #include <rtems/score/thread.h> |
---|
27 | #include <rtems/score/threadq.h> |
---|
28 | #if defined(RTEMS_MULTIPROCESSING) |
---|
29 | #include <rtems/score/mpci.h> |
---|
30 | #endif |
---|
31 | |
---|
32 | /*PAGE |
---|
33 | * |
---|
34 | * _CORE_barrier_Release |
---|
35 | * |
---|
36 | * Input parameters: |
---|
37 | * the_barrier - the barrier to be flushed |
---|
38 | * id - id of the object for a remote unblock |
---|
39 | * api_barrier_mp_support - api dependent MP support actions |
---|
40 | * |
---|
41 | * Output parameters: |
---|
42 | * CORE_BARRIER_STATUS_SUCCESSFUL - if successful |
---|
43 | * core error code - if unsuccessful |
---|
44 | * |
---|
45 | * Output parameters: |
---|
46 | * returns number of threads unblocked |
---|
47 | */ |
---|
48 | |
---|
49 | uint32_t _CORE_barrier_Release( |
---|
50 | CORE_barrier_Control *the_barrier, |
---|
51 | Objects_Id id, |
---|
52 | CORE_barrier_API_mp_support_callout api_barrier_mp_support |
---|
53 | ) |
---|
54 | { |
---|
55 | Thread_Control *the_thread; |
---|
56 | uint32_t count; |
---|
57 | |
---|
58 | count = 0; |
---|
59 | while ( (the_thread = _Thread_queue_Dequeue(&the_barrier->Wait_queue)) ) { |
---|
60 | #if defined(RTEMS_MULTIPROCESSING) |
---|
61 | if ( !_Objects_Is_local_id( the_thread->Object.id ) ) |
---|
62 | (*api_barrier_mp_support) ( the_thread, id ); |
---|
63 | #endif |
---|
64 | count++; |
---|
65 | } |
---|
66 | the_barrier->number_of_waiting_threads = 0; |
---|
67 | return count; |
---|
68 | } |
---|