source: rtems/cpukit/posix/macros/rtems/posix/cond.inl @ ce92867b

4.104.114.84.95
Last change on this file since ce92867b was ce92867b, checked in by Joel Sherrill <joel.sherrill@…>, on Feb 2, 2005 at 12:06:18 AM

2005-02-01 Joel Sherrill <joel@…>

  • libblock/include/rtems/bdbuf.h, libblock/include/rtems/ide_part_table.h, libblock/src/blkdev.c, libcsupport/include/rtems/termiostypes.h, libcsupport/src/termios.c, posix/macros/rtems/posix/cond.inl, posix/macros/rtems/posix/mutex.inl : Remove warnings.
  • Property mode set to 100644
File size: 2.6 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 
79/* If we find a compiler that doesn't accept static inline functions,
80 * then this will have to move to a .c file.  Until then, we will use this.
81 */
82static inline POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
83  Objects_Id        *id,
84  Objects_Locations *location
85)
86{
87  ___POSIX_Condition_variables_Get_support( id, location );
88
89  return (POSIX_Condition_variables_Control *)
90      _Objects_Get( &_POSIX_Condition_variables_Information, *id, location );
91}
92 
93/*PAGE
94 *
95 *  _POSIX_Condition_variables_Is_null
96 */
97 
98#define _POSIX_Condition_variables_Is_null( _the_condition_variable ) \
99  (!(_the_condition_variable))
100
101#endif
102/*  end of include file */
Note: See TracBrowser for help on using the repository browser.