source: rtems/cpukit/posix/inline/rtems/posix/cond.inl @ 2837a5e

4.104.114.84.95
Last change on this file since 2837a5e was 2837a5e, checked in by Joel Sherrill <joel.sherrill@…>, on Dec 6, 2002 at 1:48:27 PM

2002-12-06 Vladimir Nesic <vnesic@…>

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