source: rtems/cpukit/posix/src/pbarrierwait.c @ 631b3c8

5
Last change on this file since 631b3c8 was 631b3c8, checked in by Sebastian Huber <sebastian.huber@…>, on 05/23/16 at 09:40:18

score: Move thread queue MP callout to context

Drop the multiprocessing (MP) dependent callout parameter from the
thread queue extract, dequeue, flush and unblock methods. Merge this
parameter with the lock context into new structure Thread_queue_Context.
This helps to gets rid of the conditionally compiled method call
helpers.

  • Property mode set to 100644
File size: 1.3 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.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/posix/barrierimpl.h>
22
23THREAD_QUEUE_OBJECT_ASSERT( POSIX_Barrier_Control, Barrier.Wait_queue );
24
25/**
26 * This directive allows a thread to wait at a barrier.
27 *
28 * @param[in] barrier is the barrier id
29 *
30 * @retval 0 if successful
31 * @retval PTHREAD_BARRIER_SERIAL_THREAD if successful
32 * @retval error_code if unsuccessful
33 */
34
35int pthread_barrier_wait(
36  pthread_barrier_t *barrier
37)
38{
39  POSIX_Barrier_Control *the_barrier;
40  Thread_queue_Context   queue_context;
41  Thread_Control        *executing;
42
43  if ( barrier == NULL ) {
44    return EINVAL;
45  }
46
47  the_barrier = _POSIX_Barrier_Get( barrier, &queue_context );
48
49  if ( the_barrier == NULL ) {
50    return EINVAL;
51  }
52
53  executing = _Thread_Executing;
54  _CORE_barrier_Seize(
55    &the_barrier->Barrier,
56    executing,
57    true,
58    0,
59    &queue_context
60  );
61  return _POSIX_Barrier_Translate_core_barrier_return_code(
62    executing->Wait.return_code
63  );
64}
Note: See TracBrowser for help on using the repository browser.