source: rtems/cpukit/posix/macros/rtems/posix/cond.inl @ 1d386ff

4.104.114.84.95
Last change on this file since 1d386ff was 6c2675d, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/21/04 at 06:27:15

Add doxygen preamble.

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/**
2 * @file rtems/posix/cond.inl
3 */
4
5/*  rtems/posix/cond.inl
6 *
7 *  This include file contains the macro implementation of the private
8 *  inlined routines for POSIX condition variables.
9 *
10 *  COPYRIGHT (c) 1989-2002.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 *
17 *  $Id$
18 */
19 
20#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_inl
21#define __RTEMS_POSIX_CONDITION_VARIABLES_inl
22 
23#include <pthread.h>
24
25/*PAGE
26 *
27 *  _POSIX_Condition_variables_Allocate
28 */
29 
30#define _POSIX_Condition_variables_Allocate() \
31  (POSIX_Condition_variables_Control *) \
32    _Objects_Allocate( &_POSIX_Condition_variables_Information )
33 
34/*PAGE
35 *
36 *  _POSIX_Condition_variables_Free
37 *
38 *  NOTE: The support macro makes it possible for both to use exactly
39 *        the same code to check for NULL id pointer and
40 *        PTHREAD_COND_INITIALIZER without adding overhead.
41 */
42 
43#define _POSIX_Condition_variables_Free( _the_condition_variable ) \
44  _Objects_Free( &_POSIX_Condition_variables_Information, \
45    &(_the_condition_variable)->Object)
46 
47/*PAGE
48 *
49 *  _POSIX_Condition_variables_Get
50 *
51 *  NOTE: The support macro makes it possible for both to use exactly
52 *        the same code to check for NULL id pointer and
53 *        PTHREAD_COND_INITIALIZER without adding overhead.
54 */
55
56#define ___POSIX_Condition_variables_Get_support( _id, _location ) \
57  do { \
58    int _status; \
59    \
60    if ( !_id ) { \
61      *_location = OBJECTS_ERROR; \
62      return (POSIX_Condition_variables_Control *) 0; \
63    }  \
64    \
65    if ( *_id == PTHREAD_COND_INITIALIZER ) { \
66      /* \
67       *  Do an "auto-create" here. \
68       */ \
69    \
70      _status = pthread_cond_init( _id, 0 ); \
71      if ( _status ) { \
72        *_location = OBJECTS_ERROR;  \
73        return (POSIX_Condition_variables_Control *) 0; \
74      } \
75    } \
76  } while (0)
77 
78 
79static POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
80  Objects_Id        *id,
81  Objects_Locations *location
82)
83{
84  ___POSIX_Condition_variables_Get_support( id, location );
85
86  return (POSIX_Condition_variables_Control *)
87      _Objects_Get( &_POSIX_Condition_variables_Information, *id, location );
88}
89 
90/*PAGE
91 *
92 *  _POSIX_Condition_variables_Is_null
93 */
94 
95#define _POSIX_Condition_variables_Is_null( _the_condition_variable ) \
96  (!(_the_condition_variable))
97
98#endif
99/*  end of include file */
Note: See TracBrowser for help on using the repository browser.