source: rtems/cpukit/posix/src/pbarrierwait.c @ 5cb175bb

4.115
Last change on this file since 5cb175bb was 5cb175bb, checked in by Joel Sherrill <joel.sherrill@…>, on 01/10/13 at 19:22:31

cpukit/posix: Doxygen group is POSIXAPI

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 * @file
3 *
4 * @brief Wait at a Barrier
5 * @ingroup POSIXAPI
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.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <pthread.h>
22#include <errno.h>
23
24#include <rtems/system.h>
25#include <rtems/posix/barrier.h>
26
27/**
28 * This directive allows a thread to wait at a barrier.
29 *
30 * @param[in] barrier is the barrier id
31 *
32 * @retval 0 if successful
33 * @retval PTHREAD_BARRIER_SERIAL_THREAD if successful
34 * @retval error_code if unsuccessful
35 */
36
37int pthread_barrier_wait(
38  pthread_barrier_t *barrier
39)
40{
41  POSIX_Barrier_Control   *the_barrier = NULL;
42  Objects_Locations        location;
43
44  if ( !barrier )
45    return EINVAL;
46
47  the_barrier = _POSIX_Barrier_Get( barrier, &location );
48  switch ( location ) {
49
50    case OBJECTS_LOCAL:
51      _CORE_barrier_Wait(
52        &the_barrier->Barrier,
53        the_barrier->Object.id,
54        true,
55        0,
56        NULL
57      );
58      _Thread_Enable_dispatch();
59      return _POSIX_Barrier_Translate_core_barrier_return_code(
60                _Thread_Executing->Wait.return_code );
61
62#if defined(RTEMS_MULTIPROCESSING)
63    case OBJECTS_REMOTE:
64#endif
65    case OBJECTS_ERROR:
66      break;
67  }
68
69  return EINVAL;
70}
Note: See TracBrowser for help on using the repository browser.