source: rtems/cpukit/posix/include/rtems/posix/barrierimpl.h @ dce48791

5
Last change on this file since dce48791 was dce48791, checked in by Sebastian Huber <sebastian.huber@…>, on 05/23/16 at 11:37:59

score: Add Status_Control for all APIs

Unify the status codes of the Classic and POSIX API to use the new enum
Status_Control. This eliminates the Thread_Control::Wait::timeout_code
field and the timeout parameter of _Thread_queue_Enqueue_critical() and
_MPCI_Send_request_packet(). It gets rid of the status code translation
tables and instead uses simple bit operations to get the status for a
particular API. This enables translation of status code constants at
compile time. Add _Thread_Wait_get_status() to avoid direct access of
thread internal data structures.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/**
2 * @file
3 *
4 * @brief Inlined Routines from the POSIX Barrier Manager
5 *
6 * This file contains the static inlin implementation of the inlined
7 * routines from the POSIX Barrier Manager.
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2011.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#ifndef _RTEMS_POSIX_BARRIERIMPL_H
20#define _RTEMS_POSIX_BARRIERIMPL_H
21
22#include <rtems/posix/barrier.h>
23#include <rtems/score/corebarrierimpl.h>
24#include <rtems/score/objectimpl.h>
25
26#include <errno.h>
27#include <pthread.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/**
34 *  The following defines the information control block used to manage
35 *  this class of objects.
36 */
37
38extern Objects_Information _POSIX_Barrier_Information;
39
40/**
41 * @brief Allocate a barrier control block.
42 *
43 * This function allocates a barrier control block from
44 * the inactive chain of free barrier control blocks.
45 */
46RTEMS_INLINE_ROUTINE POSIX_Barrier_Control *_POSIX_Barrier_Allocate( void )
47{
48  return (POSIX_Barrier_Control *)
49    _Objects_Allocate( &_POSIX_Barrier_Information );
50}
51
52/**
53 * @brief Free a barrier control block.
54 *
55 * This routine frees a barrier control block to the
56 * inactive chain of free barrier control blocks.
57 */
58RTEMS_INLINE_ROUTINE void _POSIX_Barrier_Free (
59  POSIX_Barrier_Control *the_barrier
60)
61{
62  _CORE_barrier_Destroy( &the_barrier->Barrier );
63  _Objects_Free( &_POSIX_Barrier_Information, &the_barrier->Object );
64}
65
66RTEMS_INLINE_ROUTINE POSIX_Barrier_Control *_POSIX_Barrier_Get(
67  const pthread_barrier_t *barrier,
68  Thread_queue_Context    *queue_context
69)
70{
71  _Thread_queue_Context_initialize( queue_context, NULL );
72  return (POSIX_Barrier_Control *) _Objects_Get(
73    (Objects_Id) *barrier,
74    &queue_context->Lock_context,
75    &_POSIX_Barrier_Information
76  );
77}
78
79#ifdef __cplusplus
80}
81#endif
82
83#endif
84/*  end of include file */
Note: See TracBrowser for help on using the repository browser.