source: rtems/cpukit/score/src/corebarrierwait.c @ 5a58b1e

4.115
Last change on this file since 5a58b1e was 5a58b1e, checked in by Daniel Georgiev <daniel.georgiev95@…>, on 12/01/12 at 14:53:45

score misc: Score misc: Clean up Doxygen #11 (GCI 2012)

This patch is a task from GCI 2012 which improves the Doxygen
comments in the RTEMS source.

http://www.google-melange.com/gci/task/view/google/gci2012/8013204

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Wait For The Barrier
5 *  @ingroup ScoreBarrier
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2006.
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.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/score/isr.h>
23#include <rtems/score/corebarrier.h>
24#include <rtems/score/states.h>
25#include <rtems/score/thread.h>
26#include <rtems/score/threadq.h>
27
28void _CORE_barrier_Wait(
29  CORE_barrier_Control                *the_barrier,
30  Objects_Id                           id,
31  bool                                 wait,
32  Watchdog_Interval                    timeout,
33  CORE_barrier_API_mp_support_callout  api_barrier_mp_support
34)
35{
36  Thread_Control *executing;
37  ISR_Level       level;
38
39  executing = _Thread_Executing;
40  executing->Wait.return_code = CORE_BARRIER_STATUS_SUCCESSFUL;
41  _ISR_Disable( level );
42  the_barrier->number_of_waiting_threads++;
43  if ( _CORE_barrier_Is_automatic( &the_barrier->Attributes ) ) {
44    if ( the_barrier->number_of_waiting_threads ==
45         the_barrier->Attributes.maximum_count) {
46      executing->Wait.return_code = CORE_BARRIER_STATUS_AUTOMATICALLY_RELEASED;
47      _ISR_Enable( level );
48      _CORE_barrier_Release( the_barrier, id, api_barrier_mp_support );
49      return;
50    }
51  }
52
53  _Thread_queue_Enter_critical_section( &the_barrier->Wait_queue );
54  executing->Wait.queue          = &the_barrier->Wait_queue;
55  executing->Wait.id             = id;
56  _ISR_Enable( level );
57
58  _Thread_queue_Enqueue( &the_barrier->Wait_queue, timeout );
59}
Note: See TracBrowser for help on using the repository browser.