Ignore:
Timestamp:
Dec 6, 2002, 1:48:27 PM (19 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
83333e9
Parents:
baa8dd7c
Message:

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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/inline/rtems/posix/cond.inl

    rbaa8dd7c r2837a5e  
    44 *  inlined routines for POSIX condition variables.
    55 *
    6  *  COPYRIGHT (c) 1989-1999.
     6 *  COPYRIGHT (c) 1989-2002.
    77 *  On-Line Applications Research Corporation (OAR).
    88 *
     
    1717#define __RTEMS_POSIX_CONDITION_VARIABLES_inl
    1818 
     19#include <pthread.h>
     20
    1921/*PAGE
    2022 *
     
    4850 *  _POSIX_Condition_variables_Get
    4951 */
    50  
    51 RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
     52
     53RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control
     54*_POSIX_Condition_variables_Get (
    5255  Objects_Id        *id,
    5356  Objects_Locations *location
    5457)
    5558{
    56 /* XXX should support COND_INITIALIZER */
    57   if ( id )
    58     return (POSIX_Condition_variables_Control *)
    59       _Objects_Get( &_POSIX_Condition_variables_Information, *id, location );
     59  int status;
    6060
    61   *location = OBJECTS_ERROR;
    62   return NULL;
     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 );
    6384}
    6485 
Note: See TracChangeset for help on using the changeset viewer.